简体   繁体   中英

Raphael.js - can I use .show/.hide with fade effect?

Is there a way to make element fade in or fade out using Raphael.js? My code is something like:

var elem = paper.circle(10, 10, 10)
elem.hide();

Is there an attribute to .hide() to make fade effect, something like:

var elem = paper.circle(10, 10, 10)
elem.hide({'duration':5000});

You can animate opacity for fade effect

var elem = paper.circle(10, 10, 10);
elem.animate({ opacity : 0 }, 1000, function () { this.hide() });

To fadeIn,

elem.show().animate({ opacity : 1 }, 1000);

You can do it without animations also: http://jsfiddle.net/3jsFe/1/

You need to take the elem.node

$(elem.node).fadeOut(2000, function() {
    $(elem.node).fadeIn(2000);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM