我正在尝试使用getBBox()在文本元素周围绘制一个矩形,代码非常简单,创建文档,添加文本元素,启动文档和添加矩形.问题是getBBox返回一些奇怪的值,我错过了什么?
DOMImplementation impl;
String svgNS;
SVGDocument doc;
Element svgRoot;
UserAgent userAgent;
DocumentLoader loader;
BridgeContext ctx;
GVTBuilder builder;
GraphicsNode rootGN;
...
// get a DOM and create a document
impl = SVGDOMImplementation.getDOMImplementation();
svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
doc = (SVGDocument)impl.createDocument(svgNS, "svg", null);
// Get (the 'svg' element).
svgRoot = doc.getDocumentElement();
// Set the width and height attributes on the root 'svg' element.
svgRoot.setAttributeNS(svgNS, "width", "400");
svgRoot.setAttributeNS(svgNS, "height", "450");
// Add a text element
Element txtElem = doc.createElementNS(svgNS, "text");
txtElem.setAttributeNS(svgNS, "x", "30");
txtElem.setAttributeNS(svgNS, "y", …Run Code Online (Sandbox Code Playgroud) 我正在尝试循环CSS3转换,想法是在元素中添加一个类来启动转换并监听transitionend事件,当事件被触发时我删除了类并重新开始.
var transition = function () {
// add class to start the transition
flipper.addClass('flipped');
flipper.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
// remove class when transition is done
flipper.removeClass('flipped');
transition();
});
}
Run Code Online (Sandbox Code Playgroud)
问题是它只在第一次运行时,第二次添加类时永远不会触发事件.
有没有其他方法来循环过渡?