I'm just trying to figure out a way to use a swiffy outputted HTML5 animation in an iOS app but I can't drop the grey background. I thought this would be a way to drop animations in and circumvent the storage issues of using a png on a retina iPad display. Now I can't make the background clear. What should I do?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Xcode: Is there a way to change line spacing (UI L
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
In the code that Swiffy generated, look for backgroundColor and remove it including its value.
None of this worked for me (using ver 5.2), solved by setting new style:
According to http://css-tricks.com/override-inline-styles-with-css/ , you can use this CSS hack
Try to locate element with solid background and change it dynamically to transparent, like this:
or to none
Add this to your css or something similar.
Removing the backgroundColor: element did not work for me until I discovered that Google have broken the ability to do this in the current version of the Swiffy runtime. If you also change:
src="https://www.gstatic.com/swiffy/v5.2/runtime.js"
to
src="https://www.gstatic.com/swiffy/v5.1/runtime.js"
at the top of the file you should find that the transparent background works correctly (although, of course, any enhancements in the 5.2 library won't be available any more).
EDIT: It has been pointed out by Michael Prescott that this solution won't work reliably because of a mismatch between the Swiffy converter version and the runtime. An alternative solution that doesn't depend on the presence of the 5.1 exporter is to build on the other solutions suggested here. Try adding the following function to the script. It polls to see when the Swiffy object has installed it's preferred background color and then it replaces it.
This doesn't seem to show a glitch when Swiffy first sets a solid background and then it gets replaced. However to be more certain you can enable the commented out lines to hide the first node until the correct transparency has been set.
best regards