我试图动画一些SVG元素使用Tweenmax.jsTweenMax.js变换旋转在IE浏览器无法正常工作9
风车旋转工作正常,但门打开动画没有(风车,开门)在Internet Explorer在所有的工作9.
这里是我的代码:
var dooropen = $('#door-open');
var windmill = $('#windmill');
function DoorOpen() {
TweenMax.to(dooropen, 3, {
rotationY: 180,
transformOrigin: "0% 0%"
});
}
function rotateFan() {
TweenMax.to(windmill, 40, {
rotation: 360,
transformOrigin: "51% 64%"
});
}
$('.run').click(function() {
DoorOpen();
rotateFan();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js"></script>
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" width="887.996" height="567.947">
<path fill="#231F20" d="M89.917 99.025h31.58v468.42h-31.58z" />
<g id="windmill" fill="#FFF" stroke="#231F20" stroke-miterlimit="10">
<path d="M105.706 116.57s-50.877-56.142 0-115.79c0 0 47.368 57.894 0 115.79zM105.707 116.57s73.15-19.732 103.088 52.726c0 0-73.114 15.808-103.088-52.727z" />
<path d="M105.707 116.57S76.25 186.372.71 165.385c0 0 32.528-67.36 104.997-48.817z" />
</g>
<path fill="#FFF" stroke="#231F20" stroke-miterlimit="10" d="M485.496 162.376h402v402h-402z" />
<path fill="#231F20" d="M567.496 266.376h246v298h-246z" />
<g id="door-open">
<path fill="#B51543" d="M567.496 266.376h246v298h-246z" />
<path fill="#841C3F" d="M791.496 419.376c0 2.762-2.238 5-5 5h-26c-2.762 0-5-2.238-5-5v-26c0-2.762 2.238-5 5-5h26c2.762 0 5 2.238 5 5v26z" />
</g>
</svg>
<a href="javascript:void(0);" class="run">Run</a>
我认为** [this](http://greensock.com/forums/topic/11277-is-transformorigin-supported-in-ie9/#entry45624)**应该可以帮助你,即**双值* *用于'transformOrigin'属性的IE9语法。 –
@塔希尔艾哈迈德是对的!即使第三个参数被重写,双值语法也是优选的。无论如何,第三个值自动默认为零,因为这是spec 0中的默认值。而且只有在使用3D变换时才需要,因为它将自身与z轴对齐。但它看起来像你的问题是你的混音字符串的数值与数值。默认的转换原点是百分比'50%50%0'。因此,最好坚持基于百分比或数值的变换原点。 https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin –