Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Possible new feature] add transforms for SVG Plugin #31

Closed
thednp opened this issue Aug 20, 2016 · 0 comments
Closed

[Possible new feature] add transforms for SVG Plugin #31

thednp opened this issue Aug 20, 2016 · 0 comments
Assignees
Milestone

Comments

@thednp
Copy link
Owner

thednp commented Aug 20, 2016

I feel we need something for SVG since CSS transform property doesn't work with SVG even on latest IE, I'm thinking of a new property svgTransform to accept anything SVG can work with transforms.

The new property will process transforms this way:

var endValues = {
  translate: [x, y]; //or just x
  rotate: [angle, x, y], // where x and y represent the transform-origin
  skewX: angle,
  skewY: angle,
  scale: v
};

Now since the SVG 2.0 draft is final and the presentation attribute for transform is not deprecated, especially because it's cross-browser supported, we're gonna use it instead of CSS3 transform we already have in the core engine to keep performance tight.

Another advantage of using the presentation attribute is the fact that we don't have to deal with browser prefixes, at all. It just works.

Those being said, a possible tween object would look like this:

var tween = KUTE.fromTo('selector', {svgTransform: startValues}, {svgTransform: endValues}, {easing: 'linear'});

And the HTML would look like this

<svg viewbox="0 0 300 300">
  <rect x='75' y='75' width='150' height='150' transform='translate(100 0) rotate(45 150,150) scale(2 1.5)' />
</svg>

UPDATE: the new plugin is almost ready to commit, currently testing and documenting.

UPDATE: working on a function to automatically adjust translation when scale is used.

UPDATE: the automatic adjustments for scale is working fine, but scale will only work with one value only instead of single/array.

@thednp thednp added this to the 1.5.2 milestone Aug 20, 2016
@thednp thednp self-assigned this Aug 20, 2016
thednp referenced this issue Aug 21, 2016
* Documentation/demo updates
@thednp thednp closed this as completed Aug 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant