Created
July 11, 2012 20:42
-
-
Save martinklepsch/3093244 to your computer and use it in GitHub Desktop.
Trying to get an animation from one path to another working here... onclick
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function(){ | |
var paper = new Raphael("pseudologo", 160, 300), | |
// shape = paper.circle(80, 140, 50), | |
circlepath = "M80,40c0,-30 40,-30 40,0z", | |
rectpath = "M15,179l140,0 0,30 -140,0z", | |
groovy = { stroke: "none", fill: Raphael.hsl(117, 53, 76), cursor: "pointer" }, | |
dashed = { fill: "green", stroke: "black", "stroke-dasharray": "- " } | |
testtrigger = paper.circle(20, 20, 20).attr(groovy) | |
// var rect = paper.path(path2).attr(dashed) | |
// shape.attr(groovy) | |
// shape.hover( | |
// function() { shape.animate({fill: Raphael.hsl(297, 53, 76)}, 250) }, | |
// function () { shape.animate({fill: Raphael.hsl(117, 53, 76)}, 250) }); | |
var el = paper.path(rectpath).attr(groovy), | |
elattrs = [{path: rectpath}, {path: circlepath}], | |
now = 1; | |
console.debug(testtrigger) | |
testtrigger.node.onclick = function() { | |
el.stop().animate(elattrs[+(now = !now)], 1000); | |
// location = "/"; this.style.curser = 'pointer'; | |
} | |
// var mk = paper.text(80, 50, "M K").attr({fill: '#fff'}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried to do it like here (http://raphaeljs.com/animation.html) but apparently I fail...
Error Message:
Uncaught TypeError: Cannot set property 'onclick' of undefined