├── .gitattributes ├── AIR_Android_readme.txt ├── AIR_iOS_readme.txt ├── HEAD ├── ParticleDesigner.as3proj ├── README.md ├── application.xml ├── bat ├── CreateCertificate.bat ├── InstallAirRuntime.bat ├── PackageApp.bat ├── Packager.bat ├── RunApp.bat ├── SetupApp.bat └── SetupSDK.bat ├── bin ├── ParticleDesigner.swf └── assets │ ├── Thumbs.db │ ├── angulex.png │ ├── bg.png │ ├── blendcircle.png │ ├── blurb.png │ ├── bomb.png │ ├── btg.png │ ├── butterfly.png │ ├── circle.png │ ├── coin.png │ ├── colorpicker.png │ ├── colorpointer.png │ ├── eyesmall.png │ ├── f1.png │ ├── f2.png │ ├── f3.png │ ├── f4.png │ ├── f5.png │ ├── f6.png │ ├── fonts │ ├── abel.fnt │ ├── abel.png │ ├── fatcow.fnt │ ├── fatcow.png │ ├── fontgt.fnt │ ├── fontgt.png │ ├── small_dot_digital.fnt │ └── small_dot_digital.png │ ├── holecolorcircle.png │ ├── layerbg.png │ ├── layertopgraphic.png │ ├── layervisible.png │ ├── lg.png │ ├── line.png │ ├── logo.png │ ├── mathsumrunicon.png │ ├── mathsumrunwriting.png │ ├── opacitycircle.png │ ├── parrot.png │ ├── pic.jpg │ ├── point.png │ ├── potion.png │ ├── smallcircle.png │ ├── smoke1.png │ ├── story.pex │ ├── txt1.png │ ├── txt2.png │ ├── txt3.png │ ├── txt4.png │ ├── txt5.png │ └── txt6.png ├── cert ├── Fake.mobileprovision ├── Fake.p12 └── ParticleDesigner.p12 ├── config ├── description ├── dist ├── ParticleDesigner-app-store.ipa └── ParticleDesigner-captive-runtime.apk ├── fusing.txt ├── hooks ├── applypatch-msg.sample ├── commit-msg.sample ├── post-update.sample ├── pre-applypatch.sample ├── pre-commit.sample ├── pre-push.sample ├── pre-rebase.sample ├── prepare-commit-msg.sample └── update.sample ├── icons and ui.xar ├── icons ├── android │ └── icons │ │ ├── icon_114.png │ │ ├── icon_120.png │ │ ├── icon_144.png │ │ ├── icon_152.png │ │ ├── icon_192.png │ │ ├── icon_48.png │ │ ├── icon_57.png │ │ ├── icon_72.png │ │ ├── icon_76.png │ │ └── icon_96.png └── ios │ ├── Default-568h@2x.png │ ├── Default-Landscape.png │ ├── Default-Portrait.png │ ├── Default.png │ ├── Default@2x.png │ └── icons │ ├── icon_114.png │ ├── icon_120.png │ ├── icon_144.png │ ├── icon_152.png │ ├── icon_192.png │ ├── icon_48.png │ ├── icon_512.png │ ├── icon_57.png │ ├── icon_72.png │ ├── icon_76.png │ └── icon_96.png ├── info └── exclude ├── lib └── starling.swc ├── obj ├── ParticleDesignerConfig.old └── ParticleDesignerConfig.xml ├── particles blubs.xar ├── src ├── com │ ├── cosmindolha │ │ └── particledesigner │ │ │ ├── DataDispatcher.as │ │ │ ├── Main.as │ │ │ ├── ParticleScreen.as │ │ │ ├── Resource.as │ │ │ ├── UIStarlingScreen.as │ │ │ ├── events │ │ │ ├── ChangeBlendEvent.as │ │ │ ├── ColorPickerEvent.as │ │ │ ├── CurrentButtonEvent.as │ │ │ ├── CurrentColorButtonEvent.as │ │ │ ├── CurrentMenuButtonEvent.as │ │ │ ├── CurrentValEvent.as │ │ │ ├── LayerEvents.as │ │ │ ├── MoveParticleEvent.as │ │ │ ├── PictureEvent.as │ │ │ ├── SetColorPickerEvent.as │ │ │ ├── SetDataEvent.as │ │ │ ├── SetKnobEvent.as │ │ │ ├── TextureEvent.as │ │ │ ├── UpdateLayerPreviewEvent.as │ │ │ └── XmlLoadedEvent.as │ │ │ └── ui │ │ │ ├── Button.as │ │ │ ├── ButtonLayers.as │ │ │ ├── ColorButton.as │ │ │ ├── ColorPicker.as │ │ │ ├── KnobBlendColorStarling.as │ │ │ ├── KnobButtonStarling.as │ │ │ ├── LayerHolder.as │ │ │ ├── Layers.as │ │ │ ├── PictureHolder.as │ │ │ ├── PicturePicker.as │ │ │ ├── RightMenuButton.as │ │ │ ├── TextureHolder.as │ │ │ └── TexturePicker.as │ ├── gskinner │ │ ├── .DS_Store │ │ ├── geom │ │ │ └── ColorMatrix.as │ │ └── motion │ │ │ ├── .DS_Store │ │ │ ├── GTween.as │ │ │ ├── GTweenTimeline.as │ │ │ ├── GTweener.as │ │ │ ├── easing │ │ │ ├── Back.as │ │ │ ├── Bounce.as │ │ │ ├── Circular.as │ │ │ ├── Cubic.as │ │ │ ├── Elastic.as │ │ │ ├── Exponential.as │ │ │ ├── Linear.as │ │ │ ├── Quadratic.as │ │ │ ├── Quartic.as │ │ │ ├── Quintic.as │ │ │ └── Sine.as │ │ │ └── plugins │ │ │ ├── AutoHidePlugin.as │ │ │ ├── BlurPlugin.as │ │ │ ├── ColorAdjustPlugin.as │ │ │ ├── ColorTransformPlugin.as │ │ │ ├── CurrentFramePlugin.as │ │ │ ├── IGTweenPlugin.as │ │ │ ├── MatrixPlugin.as │ │ │ ├── MotionBlurPlugin.as │ │ │ ├── SmartRotationPlugin.as │ │ │ ├── SnappingPlugin.as │ │ │ └── SoundTransformPlugin.as │ └── utils │ │ └── Delay.as ├── de │ └── flintfabrik │ │ └── starling │ │ ├── display │ │ ├── FFParticleSystem.as │ │ └── FFParticleSystem │ │ │ ├── Frame.as │ │ │ ├── Particle.as │ │ │ └── SystemOptions.as │ │ └── utils │ │ └── ColorArgb.as ├── fw │ └── anim │ │ └── AnimSprite.as └── starling │ ├── extensions │ ├── ColorArgb.as │ ├── PDParticle.as │ ├── PDParticleSystem.as │ ├── ParallaxLayer.as │ ├── Particle.as │ ├── ParticleSystem.as │ └── TextureMask.as │ └── filters │ ├── AnselFilter.as │ ├── BaseFilter.as │ ├── BleachFilter.as │ ├── BloomFilter.as │ ├── CRTFilter.as │ ├── ChromakeyFilter.as │ ├── CrossHatchFilter.as │ ├── CrossProcessingFilter.as │ ├── FlashlightFilter.as │ ├── GlassFilter.as │ ├── GodRaysFilter.as │ ├── LightStreakFilter.as │ ├── LineGlitchFilter.as │ ├── LomoFilter.as │ ├── MotionBlurFilter.as │ ├── NewsprintFilter.as │ ├── NoiseFilter.as │ ├── PixelateFilter.as │ ├── PosterizeFilter.as │ ├── ScanlineFilter.as │ ├── ScratchedFilmFilter.as │ ├── SineFilter.as │ ├── SpotlightFilter.as │ ├── TiltShiftFilter.as │ ├── ToyBlockFilter.as │ ├── VCRFilter.as │ ├── VignetteFilter.as │ ├── WarpFilter.as │ └── assets │ ├── cross-processing.jpg │ └── filmnoise.jpg └── todolist.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /AIR_Android_readme.txt: -------------------------------------------------------------------------------- 1 | AIR for Android instructions 2 | 3 | 1. Configuration: 4 | 5 | - edit 'bat\SetupSDK.bat' for paths to Flex SDK and Android SDK (defaults should be ok) 6 | 7 | - install your device's USB drivers: 8 | http://developer.android.com/sdk/oem-usb.html 9 | - enable "USB debugging" on your Android device: 10 | Parameters > Applications > Development > USB Debugging 11 | 12 | 13 | 2. Creating a self-signed certificate: 14 | 15 | - run 'bat\CreateCertificate.bat' to generate your self-signed certificate, 16 | 17 | (!) wait a minute before packaging. 18 | 19 | 20 | 3. Build from FlashDevelop as usual (F8) 21 | 22 | 23 | 4. Run/debug the application on the desktop as usual (F5 or Ctrl+Enter) 24 | 25 | 26 | 5. Install AIR runtime on your device: 27 | 28 | - run 'bat\InstallAirRuntime.bat' 29 | 30 | 31 | 6. Running/debugging the application on the device: 32 | 33 | 6.a. Build/Debug directly on device 34 | - edit 'bat\RunApp.bat' and change the run target 'goto desktop' by 'goto android-debug' 35 | - build & run as usual (Ctrl+Enter or F5) to package, install & run the application on your device 36 | 37 | 6.b. Debug occasionally on device 38 | - Debug-build from FlashDevelop (F8) 39 | - run 'bat\PackageApp.bat' to package and install a debug version of the application 40 | - start FlashDevelop debugger: Debug > Start Remote Session 41 | - start the application on device 42 | - the application should connect to FlashDevelop interactive debugger as usual 43 | 44 | 45 | 7. Packaging for release: 46 | 47 | - Release-build from FlashDevelop (F8) 48 | - run 'bat\PackageApp.bat' and select Android/normal target 49 | -------------------------------------------------------------------------------- /AIR_iOS_readme.txt: -------------------------------------------------------------------------------- 1 | AIR for iOS instructions 2 | 3 | 1. Configuration: 4 | 5 | - edit 'bat\SetupSDK.bat' for path to Flex SDK (defaults should be ok) 6 | 7 | 3. Build from FlashDevelop as usual (F8) 8 | 9 | 4. Run/debug the application on the desktop as usual (F5 or Ctrl+Enter) 10 | 11 | 5. Configure for iOS packaging in 'bat\SetupApp.bat': 12 | 13 | Take a deep breath, pay the Apple tax and read extra carefully this tutorial: 14 | - http://www.codeandvisual.com/2011/exporting-for-iphone-using-air-27-and-flashdevelop-part-three-generating-developer-certificates-provisioning-profiles-and-p12-files/ 15 | 16 | Now this is how to create the p12 key entirely on Windows (steps 1. to 8.): 17 | - http://connorullmann.com/2011/04/air-2-6-and-ios/ 18 | 19 | Then for each project you'll have to go to on Apple's iOS Provisioning Portal: 20 | - create a new App ID with: name of the project and ID indicated in 'application.xml', 21 | - create a new Provisioning Profile: select App ID & registered devices that will be allowed to install the app. 22 | 23 | Once you have obtained a .p12 and .mobileprovision file from Apple's Provisioning Portal: 24 | - save a copy of your .p12 and .mobileprovision certificates in the 'cert\' folder in your FlashDevelop project. 25 | (make sure to keep an extra copy of these 2 files in a safe place) 26 | 27 | Finally edit 'bat\SetupApp.bat' and complete the following lines: 28 | 29 | - IOS_DEV_CERT_FILE: path to your iOS developer 'p12' key ('cert\' folder, if you have followed the instructions above) 30 | - IOS_DEV_CERT_PASS: developer certificate's password 31 | if you don't set it, remove "-storepass %IOS_DEV_CERT_PASS%" from the IOS_SIGNING_OPTIONS, 32 | you'll be prompted to type it when packaging. 33 | - IOS_PROVISION: path to the project's Provisioning Profile file 34 | 35 | For example: 36 | 37 | set IOS_DIST_CERT_FILE=cert\iphone_dev.p12 38 | set IOS_DEV_CERT_FILE=cert\iphone_dev.p12 39 | set IOS_DEV_CERT_PASS=YourPassword 40 | set IOS_PROVISION=cert\YourFileName.mobileprovision 41 | 42 | 43 | 6. Running/debugging the application on the device: 44 | 45 | Note: if are testing your application for performance, always package for release (see step 7.) 46 | 47 | 6.a. Build/Debug on device 48 | - edit 'bat\RunApp.bat' and change the run target 'goto desktop' by 'goto ios-debug' 49 | - build as usual (Ctrl+Enter or F5) to package 50 | - you'll still have to manually upload & run the app on the device 51 | - the application should connect to FlashDevelop interactive debugger as usual 52 | 53 | 6.b. Debug occasionally on device 54 | - Debug-build from FlashDevelop (F8) 55 | - run 'bat\PackageApp.bat' to package and install a debug version of the application 56 | - start FlashDevelop debugger: Debug > Start Remote Session 57 | - start the application on device 58 | - the application should connect to FlashDevelop interactive debugger as usual 59 | 60 | 61 | 7. Packaging for release: 62 | 63 | - edit 'bat\SetupApp.bat' to add the path to your "distribution" certificate (IOS_DIST_CERT_FILE) 64 | Note: you can package ad-hoc IPAs using your developer certificate. 65 | 66 | - Release-build from FlashDevelop (F8) 67 | - run 'bat\PackageApp.bat' and select 68 | either iOS/"ad-hoc" for installation on test devices 69 | or iOS/App Store for upload in the iOS App Store. 70 | 71 | Tips: 72 | - iFunBox: iTunes replacement; installs app faster even if app version doesn't change, 73 | - TestFlightApp: ad-hoc distribution service http://testflightapp.com 74 | - HockeyKit: self hosted ad-hoc distribution https://github.com/TheRealKerni/HockeyKit 75 | - Manual ad-hoc distribution: http://samvermette.com/71 76 | -------------------------------------------------------------------------------- /HEAD: -------------------------------------------------------------------------------- 1 | ref: refs/heads/master 2 | -------------------------------------------------------------------------------- /ParticleDesigner.as3proj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Angulex - Particle Designer for Starling 2 | ============================== 3 | 4 | 5 | ![Angulex - Particle Designer](http://cosmindolha.com/wp-content/uploads/2016/01/angulex.jpg) 6 | 7 | ###Introduction 8 | 9 | Starling http://gamua.com/starling/ is a free open-source framework written in ActionScript 3 that mimics the Flash display list, but renders on GPU using the Flash Stage3D technology. 10 | It's primary use is building 2D Games that run on iOS, Android and Desktop using Adobe AIR. 11 | 12 | ###The "Why?" part 13 | 14 | Starling has a powerful Particle engine, but the tools for designing the effects are few and lack the functionality I would like to use. This is a tool I am building for myself, but hope others will find useful. 15 | 16 | ###The plan 17 | 18 | Build a design tool that will let me combine different particles with animated elements. 19 | 20 | Key functionality I want: 21 | 22 | * Design the effects directly on Tablets (iPad), so I can see the performance first hand, reducing the testing time. 23 | * Save the effects offline and when a connection is available push to my server. 24 | * Create a library of effects other GameDevs can use in their games. 25 | * Load/export graphics and .pex file to/from DropBox and Google Drive. 26 | 27 | ###Bonus unnecessary functionality, but very cool 28 | 29 | Designing on one screen, and show up on another in real time, using rtmfp p2p technology. 30 | 31 | ###Tech used 32 | 33 | * IDE - FlashDevelop 5.0.2.2 34 | * Language - ActionScript 3. 35 | * Runtime - Adobe AIR 19 https://en.wikipedia.org/wiki/Adobe_AIR 36 | * Framework - Starling http://gamua.com/starling/ 37 | * Particle System - FFParticleSystem http://www.flintfabrik.de/blog/improved-particle-system-for-starling 38 | 39 | 40 | ###When & where? 41 | 42 | While I had this tool in the back of my head for some time, the first lines of code were written at HackTM2015 Hackathon, on 6 November 2015 at around 20:30 in the company of over 300 hackers/geeks in Timisoara Romania. 43 | 44 | ###Who? 45 | 46 | Cosmin Dolha 47 | http://cosmindolha.com 48 | https://twitter.com/CosminDolha 49 | 50 | -------------------------------------------------------------------------------- /application.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | air.com.cosmindolha.particledesigner.ParticleDesigner 4 | 0.1 5 | mobileDevice 6 | ParticleDesigner 7 | ParticleDesigner 8 | 9 | 10 | 11 | 12 | 13 | ]]> 14 | 32bit 15 | 16 | 17 | UIStatusBarStyle 18 | UIStatusBarStyleBlackOpaque 19 | UIRequiresPersistentWiFi 20 | NO 21 | UIApplicationExitsOnSuspend 22 | 23 | UIDeviceFamily 24 | 25 | 2 26 | 27 | MinimumOSVersion 28 | 6.0]]> 29 | high 30 | 31 | 32 | ParticleDesigner 33 | ParticleDesigner.swf 34 | true 35 | true 36 | 37 | 38 | direct 39 | true 40 | 41 | none 42 | high 43 | false 44 | landscape 45 | false 46 | 47 | 48 | icons/icon_48.png 49 | icons/icon_57.png 50 | icons/icon_72.png 51 | icons/icon_76.png 52 | icons/icon_96.png 53 | icons/icon_114.png 54 | icons/icon_120.png 55 | icons/icon_144.png 56 | icons/icon_152.png 57 | 58 | 59 | 72 | -------------------------------------------------------------------------------- /bat/CreateCertificate.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: Set working dir 4 | cd %~dp0 & cd .. 5 | 6 | set PAUSE_ERRORS=1 7 | call bat\SetupSDK.bat 8 | call bat\SetupApp.bat 9 | 10 | :: Generate 11 | echo. 12 | echo Generating a self-signed certificate for Android packaging 13 | call adt -certificate -validityPeriod 25 -cn %AND_CERT_NAME% 2048-RSA "%AND_CERT_FILE%" %AND_CERT_PASS% 14 | if errorlevel 1 goto failed 15 | 16 | :succeed 17 | echo. 18 | echo Certificate created: %AND_CERT_FILE% with password "%AND_CERT_PASS%" 19 | echo. 20 | if "%AND_CERT_PASS%" == "fd" echo Note: you did not change the default password 21 | echo. 22 | echo HINTS: 23 | echo - you only need to generate this certificate once, 24 | echo - wait a minute before using this certificate to package your AIR application. 25 | echo. 26 | goto end 27 | 28 | :failed 29 | echo. 30 | echo Certificate creation FAILED. 31 | echo. 32 | 33 | :end 34 | pause 35 | -------------------------------------------------------------------------------- /bat/InstallAirRuntime.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: Set working dir 4 | cd %~dp0 & cd .. 5 | 6 | set PAUSE_ERRORS=1 7 | call bat\SetupSDK.bat 8 | 9 | :: AIR runtime installer 10 | set AIR_INSTALLER=%FLEX_SDK%\runtimes\air\android\device\runtime.apk 11 | 12 | :: Install 13 | adb devices 14 | echo. 15 | echo Installing AIR runtime on current device: 16 | echo %AIR_INSTALLER% 17 | echo. 18 | adb install "%AIR_INSTALLER%" 19 | echo. 20 | if errorlevel 1 goto failed 21 | goto end 22 | 23 | :failed 24 | echo Troubleshooting: 25 | echo - one, and only one, Android device should be connected 26 | echo - verify 'bat\SetupSDK.bat' 27 | echo. 28 | goto end 29 | 30 | :end 31 | pause 32 | -------------------------------------------------------------------------------- /bat/PackageApp.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: Set working dir 4 | cd %~dp0 & cd .. 5 | 6 | set PAUSE_ERRORS=1 7 | call bat\SetupSDK.bat 8 | call bat\SetupApp.bat 9 | 10 | :menu 11 | echo. 12 | echo Package for target 13 | echo. 14 | echo Android: 15 | echo. 16 | echo [1] normal (apk) 17 | echo [2] debug (apk-debug) 18 | echo [3] captive (apk-captive-runtime) 19 | echo. 20 | echo iOS: 21 | echo. 22 | echo [4] fast test (ipa-test-interpreter) 23 | echo [5] fast debug (ipa-debug-interpreter) 24 | echo [6] slow test (ipa-test) 25 | echo [7] slow debug (ipa-debug) 26 | echo [8] "ad-hoc" (ipa-ad-hoc) 27 | echo [9] App Store (ipa-app-store) 28 | echo. 29 | 30 | :choice 31 | set /P C=[Choice]: 32 | echo. 33 | 34 | set PLATFORM=android 35 | set OPTIONS= 36 | if %C% GTR 3 set PLATFORM=ios 37 | if %C% GTR 7 set PLATFORM=ios-dist 38 | 39 | if "%C%"=="1" set TARGET= 40 | if "%C%"=="2" set TARGET=-debug 41 | if "%C%"=="2" set OPTIONS=-connect %DEBUG_IP% 42 | if "%C%"=="3" set TARGET=-captive-runtime 43 | 44 | if "%C%"=="4" set TARGET=-test-interpreter 45 | if "%C%"=="5" set TARGET=-debug-interpreter 46 | if "%C%"=="5" set OPTIONS=-connect %DEBUG_IP% 47 | if "%C%"=="6" set TARGET=-test 48 | if "%C%"=="7" set TARGET=-debug 49 | if "%C%"=="7" set OPTIONS=-connect %DEBUG_IP% 50 | if "%C%"=="8" set TARGET=-ad-hoc 51 | if "%C%"=="9" set TARGET=-app-store 52 | 53 | call bat\Packager.bat 54 | 55 | if "%PLATFORM%"=="android" goto android-package 56 | 57 | :ios-package 58 | if "%AUTO_INSTALL_IOS%" == "yes" goto ios-install 59 | echo Now manually install and start application on device 60 | echo. 61 | goto end 62 | 63 | :ios-install 64 | echo Installing application for testing on iOS (%DEBUG_IP%) 65 | echo. 66 | call adt -installApp -platform ios -package "%OUTPUT%" 67 | if errorlevel 1 goto installfail 68 | 69 | echo Now manually start application on device 70 | echo. 71 | goto end 72 | 73 | :android-package 74 | adb devices 75 | echo. 76 | echo Installing %OUTPUT% on the device... 77 | echo. 78 | adb -d install -r "%OUTPUT%" 79 | if errorlevel 1 goto installfail 80 | goto end 81 | 82 | :installfail 83 | echo. 84 | echo Installing the app on the device failed 85 | 86 | :end 87 | pause 88 | -------------------------------------------------------------------------------- /bat/Packager.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: Set working dir 4 | cd %~dp0 & cd .. 5 | 6 | if "%PLATFORM%"=="android" goto android-config 7 | if "%PLATFORM%"=="ios" goto ios-config 8 | if "%PLATFORM%"=="ios-dist" goto ios-dist-config 9 | goto start 10 | 11 | :android-config 12 | set CERT_FILE=%AND_CERT_FILE% 13 | set SIGNING_OPTIONS=%AND_SIGNING_OPTIONS% 14 | set ICONS=%AND_ICONS% 15 | set DIST_EXT=apk 16 | set TYPE=apk 17 | goto start 18 | 19 | :ios-config 20 | set CERT_FILE=%IOS_DEV_CERT_FILE% 21 | set SIGNING_OPTIONS=%IOS_DEV_SIGNING_OPTIONS% 22 | set ICONS=%IOS_ICONS% 23 | set DIST_EXT=ipa 24 | set TYPE=ipa 25 | goto start 26 | :: Set working dir 27 | cd %~dp0 & cd .. 28 | 29 | :ios-dist-config 30 | set CERT_FILE=%IOS_DIST_CERT_FILE% 31 | set SIGNING_OPTIONS=%IOS_DIST_SIGNING_OPTIONS% 32 | set ICONS=%IOS_ICONS% 33 | set DIST_EXT=ipa 34 | set TYPE=ipa 35 | goto start 36 | 37 | :start 38 | if not exist "%CERT_FILE%" goto certificate 39 | :: Output file 40 | set FILE_OR_DIR=%FILE_OR_DIR% -C "%ICONS%" . 41 | if not exist "%DIST_PATH%" md "%DIST_PATH%" 42 | set OUTPUT=%DIST_PATH%\%DIST_NAME%%TARGET%.%DIST_EXT% 43 | :: Package 44 | echo Packaging: %OUTPUT% 45 | echo using certificate: %CERT_FILE%... 46 | echo. 47 | call adt -package -target %TYPE%%TARGET% %OPTIONS% %SIGNING_OPTIONS% "%OUTPUT%" "%APP_XML%" %FILE_OR_DIR% 48 | echo. 49 | if errorlevel 1 goto failed 50 | goto end 51 | 52 | :certificate 53 | echo Certificate not found: %CERT_FILE% 54 | echo. 55 | echo Android: 56 | echo - generate a default certificate using 'bat\CreateCertificate.bat' 57 | echo or configure a specific certificate in 'bat\SetupApp.bat'. 58 | echo. 59 | echo iOS: 60 | echo - configure your developer key and project's Provisioning Profile 61 | echo in 'bat\SetupApp.bat'. 62 | echo. 63 | if %PAUSE_ERRORS%==1 pause 64 | exit 65 | 66 | :failed 67 | echo APK setup creation FAILED. 68 | echo. 69 | echo Troubleshooting: 70 | echo - verify AIR SDK target version in %APP_XML% 71 | echo. 72 | if %PAUSE_ERRORS%==1 pause 73 | exit 74 | 75 | :end 76 | 77 | -------------------------------------------------------------------------------- /bat/RunApp.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: Set working dir 4 | cd %~dp0 & cd .. 5 | 6 | set PAUSE_ERRORS=1 7 | call bat\SetupSDK.bat 8 | call bat\SetupApp.bat 9 | 10 | :target 11 | goto desktop 12 | ::goto android-debug 13 | ::goto android-test 14 | set INTERPRETER=-interpreter 15 | ::goto ios-debug 16 | ::goto ios-test 17 | 18 | :desktop 19 | :: http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-6fa6d7e0128cca93d31-8000.html 20 | 21 | set SCREEN_SIZE=iPad 22 | ::set SCREEN_SIZE=iPhoneRetina 23 | 24 | :desktop-run 25 | echo. 26 | echo Starting AIR Debug Launcher with screen size '%SCREEN_SIZE%' 27 | echo. 28 | echo (hint: edit 'Run.bat' to test on device or change screen size) 29 | echo. 30 | adl -screensize %SCREEN_SIZE% "%APP_XML%" "%APP_DIR%" 31 | if errorlevel 1 goto end 32 | goto endNoPause 33 | 34 | :ios-debug 35 | echo. 36 | echo Packaging application for debugging on iOS %INTERPRETER% 37 | if "%INTERPRETER%" == "" echo (this will take a while) 38 | echo. 39 | set TARGET=-debug%INTERPRETER% 40 | set OPTIONS=-connect %DEBUG_IP% 41 | goto ios-package 42 | 43 | :ios-test 44 | echo. 45 | echo Packaging application for testing on iOS %INTERPRETER% 46 | if "%INTERPRETER%" == "" echo (this will take a while) 47 | echo. 48 | set TARGET=-test%INTERPRETER% 49 | set OPTIONS= 50 | goto ios-package 51 | 52 | :ios-package 53 | set PLATFORM=ios 54 | call bat\Packager.bat 55 | 56 | if "%AUTO_INSTALL_IOS%" == "yes" goto ios-install 57 | echo Now manually install and start application on device 58 | echo. 59 | goto end 60 | 61 | :ios-install 62 | echo Installing application for testing on iOS (%DEBUG_IP%) 63 | echo. 64 | call adt -installApp -platform ios -package "%OUTPUT%" 65 | if errorlevel 1 goto installfail 66 | 67 | echo Now manually start application on device 68 | echo. 69 | goto end 70 | 71 | :android-debug 72 | echo. 73 | echo Packaging and installing application for debugging on Android (%DEBUG_IP%) 74 | echo. 75 | set TARGET=-debug 76 | set OPTIONS=-connect %DEBUG_IP% 77 | goto android-package 78 | 79 | :android-test 80 | echo. 81 | echo Packaging and Installing application for testing on Android (%DEBUG_IP%) 82 | echo. 83 | set TARGET= 84 | set OPTIONS= 85 | goto android-package 86 | 87 | :android-package 88 | set PLATFORM=android 89 | call bat\Packager.bat 90 | 91 | adb devices 92 | echo. 93 | echo Installing %OUTPUT% on the device... 94 | echo. 95 | adb -d install -r "%OUTPUT%" 96 | if errorlevel 1 goto installfail 97 | 98 | echo. 99 | echo Starting application on the device for debugging... 100 | echo. 101 | adb shell am start -n air.%APP_ID%/.AppEntry 102 | exit 103 | 104 | :installfail 105 | echo. 106 | echo Installing the app on the device failed 107 | 108 | :end 109 | pause 110 | 111 | :endNoPause 112 | 113 | -------------------------------------------------------------------------------- /bat/SetupApp.bat: -------------------------------------------------------------------------------- 1 | :: Set working dir 2 | cd %~dp0 & cd .. 3 | 4 | :user_configuration 5 | 6 | :: About AIR application packaging 7 | :: http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7fd9.html 8 | 9 | :: NOTICE: all paths are relative to project root 10 | 11 | :: Android packaging 12 | set AND_CERT_NAME="ParticleDesigner" 13 | set AND_CERT_PASS=fd 14 | set AND_CERT_FILE=cert\ParticleDesigner.p12 15 | set AND_ICONS=icons/android 16 | 17 | set AND_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%AND_CERT_FILE%" -storepass %AND_CERT_PASS% 18 | 19 | :: iOS packaging 20 | set IOS_DIST_CERT_FILE=cert\Fake.p12 21 | set IOS_DEV_CERT_FILE=cert\Fake.p12 22 | set IOS_DEV_CERT_PASS=1234 23 | set IOS_PROVISION=cert\Fake.mobileprovision 24 | set IOS_ICONS=icons/ios 25 | 26 | set IOS_DEV_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%IOS_DEV_CERT_FILE%" -storepass %IOS_DEV_CERT_PASS% -provisioning-profile %IOS_PROVISION% 27 | set IOS_DIST_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%IOS_DIST_CERT_FILE%" -storepass %IOS_DEV_CERT_PASS% -provisioning-profile %IOS_PROVISION% 28 | 29 | :: Application descriptor 30 | set APP_XML=application.xml 31 | 32 | :: Files to package 33 | set APP_DIR=bin 34 | set FILE_OR_DIR=-C %APP_DIR% . 35 | 36 | :: Your application ID (must match of Application descriptor) and remove spaces 37 | for /f "tokens=3 delims=<>" %%a in ('findstr /R /C:"^[ ]*" %APP_XML%') do set APP_ID=%%a 38 | set APP_ID=%APP_ID: =% 39 | 40 | :: Output packages 41 | set DIST_PATH=dist 42 | set DIST_NAME=ParticleDesigner 43 | 44 | :: Debugging using a custom IP 45 | set DEBUG_IP= 46 | 47 | :validation 48 | findstr /C:"%APP_ID%" "%APP_XML%" > NUL 49 | if errorlevel 1 goto badid 50 | goto end 51 | 52 | :badid 53 | echo. 54 | echo ERROR: 55 | echo Application ID in 'bat\SetupApp.bat' (APP_ID) 56 | echo does NOT match Application descriptor '%APP_XML%' (id) 57 | echo. 58 | 59 | :end 60 | -------------------------------------------------------------------------------- /bat/SetupSDK.bat: -------------------------------------------------------------------------------- 1 | :: Set working dir 2 | cd %~dp0 & cd .. 3 | 4 | :user_configuration 5 | 6 | :: Static path to Flex SDK 7 | set FLEX_SDK=C:\Users\workstationMobile\AppData\Local\FlashDevelop\Apps\ascsdk\20.0.0 8 | 9 | :: Use FD supplied SDK path if executed from FD 10 | if exist "%FD_CUR_SDK%" set FLEX_SDK=%FD_CUR_SDK% 11 | 12 | set AUTO_INSTALL_IOS=yes 13 | 14 | :: Path to Android SDK 15 | set ANDROID_SDK=C:\Program Files (x86)\FlashDevelop\Tools\android 16 | 17 | :validation 18 | if not exist "%FLEX_SDK%\bin" goto flexsdk 19 | if not exist "%ANDROID_SDK%\platform-tools" goto androidsdk 20 | goto succeed 21 | 22 | :flexsdk 23 | echo. 24 | echo ERROR: incorrect path to Flex SDK in 'bat\SetupSDK.bat' 25 | echo. 26 | echo Looking for: %FLEX_SDK%\bin 27 | echo. 28 | if %PAUSE_ERRORS%==1 pause 29 | exit 30 | 31 | :androidsdk 32 | echo. 33 | echo ERROR: incorrect path to Android SDK in 'bat\SetupSDK.bat' 34 | echo. 35 | echo Looking for: %ANDROID_SDK%\platform-tools 36 | echo. 37 | if %PAUSE_ERRORS%==1 pause 38 | exit 39 | 40 | :succeed 41 | set PATH=%FLEX_SDK%\bin;%PATH% 42 | set PATH=%PATH%;%ANDROID_SDK%\platform-tools 43 | -------------------------------------------------------------------------------- /bin/ParticleDesigner.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/ParticleDesigner.swf -------------------------------------------------------------------------------- /bin/assets/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/Thumbs.db -------------------------------------------------------------------------------- /bin/assets/angulex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/angulex.png -------------------------------------------------------------------------------- /bin/assets/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/bg.png -------------------------------------------------------------------------------- /bin/assets/blendcircle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/blendcircle.png -------------------------------------------------------------------------------- /bin/assets/blurb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/blurb.png -------------------------------------------------------------------------------- /bin/assets/bomb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/bomb.png -------------------------------------------------------------------------------- /bin/assets/btg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/btg.png -------------------------------------------------------------------------------- /bin/assets/butterfly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/butterfly.png -------------------------------------------------------------------------------- /bin/assets/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/circle.png -------------------------------------------------------------------------------- /bin/assets/coin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/coin.png -------------------------------------------------------------------------------- /bin/assets/colorpicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/colorpicker.png -------------------------------------------------------------------------------- /bin/assets/colorpointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/colorpointer.png -------------------------------------------------------------------------------- /bin/assets/eyesmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/eyesmall.png -------------------------------------------------------------------------------- /bin/assets/f1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/f1.png -------------------------------------------------------------------------------- /bin/assets/f2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/f2.png -------------------------------------------------------------------------------- /bin/assets/f3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/f3.png -------------------------------------------------------------------------------- /bin/assets/f4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/f4.png -------------------------------------------------------------------------------- /bin/assets/f5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/f5.png -------------------------------------------------------------------------------- /bin/assets/f6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/f6.png -------------------------------------------------------------------------------- /bin/assets/fonts/abel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/fonts/abel.png -------------------------------------------------------------------------------- /bin/assets/fonts/fatcow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/fonts/fatcow.png -------------------------------------------------------------------------------- /bin/assets/fonts/fontgt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/fonts/fontgt.png -------------------------------------------------------------------------------- /bin/assets/fonts/small_dot_digital.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/fonts/small_dot_digital.png -------------------------------------------------------------------------------- /bin/assets/holecolorcircle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/holecolorcircle.png -------------------------------------------------------------------------------- /bin/assets/layerbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/layerbg.png -------------------------------------------------------------------------------- /bin/assets/layertopgraphic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/layertopgraphic.png -------------------------------------------------------------------------------- /bin/assets/layervisible.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/layervisible.png -------------------------------------------------------------------------------- /bin/assets/lg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/lg.png -------------------------------------------------------------------------------- /bin/assets/line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/line.png -------------------------------------------------------------------------------- /bin/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/logo.png -------------------------------------------------------------------------------- /bin/assets/mathsumrunicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/mathsumrunicon.png -------------------------------------------------------------------------------- /bin/assets/mathsumrunwriting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/mathsumrunwriting.png -------------------------------------------------------------------------------- /bin/assets/opacitycircle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/opacitycircle.png -------------------------------------------------------------------------------- /bin/assets/parrot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/parrot.png -------------------------------------------------------------------------------- /bin/assets/pic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/pic.jpg -------------------------------------------------------------------------------- /bin/assets/point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/point.png -------------------------------------------------------------------------------- /bin/assets/potion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/potion.png -------------------------------------------------------------------------------- /bin/assets/smallcircle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/smallcircle.png -------------------------------------------------------------------------------- /bin/assets/smoke1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/smoke1.png -------------------------------------------------------------------------------- /bin/assets/story.pex: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /bin/assets/txt1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/txt1.png -------------------------------------------------------------------------------- /bin/assets/txt2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/txt2.png -------------------------------------------------------------------------------- /bin/assets/txt3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/txt3.png -------------------------------------------------------------------------------- /bin/assets/txt4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/txt4.png -------------------------------------------------------------------------------- /bin/assets/txt5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/txt5.png -------------------------------------------------------------------------------- /bin/assets/txt6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/bin/assets/txt6.png -------------------------------------------------------------------------------- /cert/Fake.mobileprovision: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/cert/Fake.mobileprovision -------------------------------------------------------------------------------- /cert/Fake.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/cert/Fake.p12 -------------------------------------------------------------------------------- /cert/ParticleDesigner.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/cert/ParticleDesigner.p12 -------------------------------------------------------------------------------- /config: -------------------------------------------------------------------------------- 1 | [core] 2 | repositoryformatversion = 0 3 | filemode = false 4 | bare = true 5 | symlinks = false 6 | ignorecase = true 7 | hideDotFiles = dotGitOnly 8 | -------------------------------------------------------------------------------- /description: -------------------------------------------------------------------------------- 1 | Unnamed repository; edit this file 'description' to name the repository. 2 | -------------------------------------------------------------------------------- /dist/ParticleDesigner-app-store.ipa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/dist/ParticleDesigner-app-store.ipa -------------------------------------------------------------------------------- /dist/ParticleDesigner-captive-runtime.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/dist/ParticleDesigner-captive-runtime.apk -------------------------------------------------------------------------------- /hooks/applypatch-msg.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to check the commit log message taken by 4 | # applypatch from an e-mail message. 5 | # 6 | # The hook should exit with non-zero status after issuing an 7 | # appropriate message if it wants to stop the commit. The hook is 8 | # allowed to edit the commit message file. 9 | # 10 | # To enable this hook, rename this file to "applypatch-msg". 11 | 12 | . git-sh-setup 13 | commitmsg="$(git rev-parse --git-path hooks/commit-msg)" 14 | test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} 15 | : 16 | -------------------------------------------------------------------------------- /hooks/commit-msg.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to check the commit log message. 4 | # Called by "git commit" with one argument, the name of the file 5 | # that has the commit message. The hook should exit with non-zero 6 | # status after issuing an appropriate message if it wants to stop the 7 | # commit. The hook is allowed to edit the commit message file. 8 | # 9 | # To enable this hook, rename this file to "commit-msg". 10 | 11 | # Uncomment the below to add a Signed-off-by line to the message. 12 | # Doing this in a hook is a bad idea in general, but the prepare-commit-msg 13 | # hook is more suited to it. 14 | # 15 | # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') 16 | # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" 17 | 18 | # This example catches duplicate Signed-off-by lines. 19 | 20 | test "" = "$(grep '^Signed-off-by: ' "$1" | 21 | sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { 22 | echo >&2 Duplicate Signed-off-by lines. 23 | exit 1 24 | } 25 | -------------------------------------------------------------------------------- /hooks/post-update.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to prepare a packed repository for use over 4 | # dumb transports. 5 | # 6 | # To enable this hook, rename this file to "post-update". 7 | 8 | exec git update-server-info 9 | -------------------------------------------------------------------------------- /hooks/pre-applypatch.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to verify what is about to be committed 4 | # by applypatch from an e-mail message. 5 | # 6 | # The hook should exit with non-zero status after issuing an 7 | # appropriate message if it wants to stop the commit. 8 | # 9 | # To enable this hook, rename this file to "pre-applypatch". 10 | 11 | . git-sh-setup 12 | precommit="$(git rev-parse --git-path hooks/pre-commit)" 13 | test -x "$precommit" && exec "$precommit" ${1+"$@"} 14 | : 15 | -------------------------------------------------------------------------------- /hooks/pre-commit.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to verify what is about to be committed. 4 | # Called by "git commit" with no arguments. The hook should 5 | # exit with non-zero status after issuing an appropriate message if 6 | # it wants to stop the commit. 7 | # 8 | # To enable this hook, rename this file to "pre-commit". 9 | 10 | if git rev-parse --verify HEAD >/dev/null 2>&1 11 | then 12 | against=HEAD 13 | else 14 | # Initial commit: diff against an empty tree object 15 | against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 16 | fi 17 | 18 | # If you want to allow non-ASCII filenames set this variable to true. 19 | allownonascii=$(git config --bool hooks.allownonascii) 20 | 21 | # Redirect output to stderr. 22 | exec 1>&2 23 | 24 | # Cross platform projects tend to avoid non-ASCII filenames; prevent 25 | # them from being added to the repository. We exploit the fact that the 26 | # printable range starts at the space character and ends with tilde. 27 | if [ "$allownonascii" != "true" ] && 28 | # Note that the use of brackets around a tr range is ok here, (it's 29 | # even required, for portability to Solaris 10's /usr/bin/tr), since 30 | # the square bracket bytes happen to fall in the designated range. 31 | test $(git diff --cached --name-only --diff-filter=A -z $against | 32 | LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 33 | then 34 | cat <<\EOF 35 | Error: Attempt to add a non-ASCII file name. 36 | 37 | This can cause problems if you want to work with people on other platforms. 38 | 39 | To be portable it is advisable to rename the file. 40 | 41 | If you know what you are doing you can disable this check using: 42 | 43 | git config hooks.allownonascii true 44 | EOF 45 | exit 1 46 | fi 47 | 48 | # If there are whitespace errors, print the offending file names and fail. 49 | exec git diff-index --check --cached $against -- 50 | -------------------------------------------------------------------------------- /hooks/pre-push.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # An example hook script to verify what is about to be pushed. Called by "git 4 | # push" after it has checked the remote status, but before anything has been 5 | # pushed. If this script exits with a non-zero status nothing will be pushed. 6 | # 7 | # This hook is called with the following parameters: 8 | # 9 | # $1 -- Name of the remote to which the push is being done 10 | # $2 -- URL to which the push is being done 11 | # 12 | # If pushing without using a named remote those arguments will be equal. 13 | # 14 | # Information about the commits which are being pushed is supplied as lines to 15 | # the standard input in the form: 16 | # 17 | # 18 | # 19 | # This sample shows how to prevent push of commits where the log message starts 20 | # with "WIP" (work in progress). 21 | 22 | remote="$1" 23 | url="$2" 24 | 25 | z40=0000000000000000000000000000000000000000 26 | 27 | while read local_ref local_sha remote_ref remote_sha 28 | do 29 | if [ "$local_sha" = $z40 ] 30 | then 31 | # Handle delete 32 | : 33 | else 34 | if [ "$remote_sha" = $z40 ] 35 | then 36 | # New branch, examine all commits 37 | range="$local_sha" 38 | else 39 | # Update to existing branch, examine new commits 40 | range="$remote_sha..$local_sha" 41 | fi 42 | 43 | # Check for WIP commit 44 | commit=`git rev-list -n 1 --grep '^WIP' "$range"` 45 | if [ -n "$commit" ] 46 | then 47 | echo >&2 "Found WIP commit in $local_ref, not pushing" 48 | exit 1 49 | fi 50 | fi 51 | done 52 | 53 | exit 0 54 | -------------------------------------------------------------------------------- /hooks/prepare-commit-msg.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to prepare the commit log message. 4 | # Called by "git commit" with the name of the file that has the 5 | # commit message, followed by the description of the commit 6 | # message's source. The hook's purpose is to edit the commit 7 | # message file. If the hook fails with a non-zero status, 8 | # the commit is aborted. 9 | # 10 | # To enable this hook, rename this file to "prepare-commit-msg". 11 | 12 | # This hook includes three examples. The first comments out the 13 | # "Conflicts:" part of a merge commit. 14 | # 15 | # The second includes the output of "git diff --name-status -r" 16 | # into the message, just before the "git status" output. It is 17 | # commented because it doesn't cope with --amend or with squashed 18 | # commits. 19 | # 20 | # The third example adds a Signed-off-by line to the message, that can 21 | # still be edited. This is rarely a good idea. 22 | 23 | case "$2,$3" in 24 | merge,) 25 | /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; 26 | 27 | # ,|template,) 28 | # /usr/bin/perl -i.bak -pe ' 29 | # print "\n" . `git diff --cached --name-status -r` 30 | # if /^#/ && $first++ == 0' "$1" ;; 31 | 32 | *) ;; 33 | esac 34 | 35 | # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') 36 | # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" 37 | -------------------------------------------------------------------------------- /hooks/update.sample: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # An example hook script to blocks unannotated tags from entering. 4 | # Called by "git receive-pack" with arguments: refname sha1-old sha1-new 5 | # 6 | # To enable this hook, rename this file to "update". 7 | # 8 | # Config 9 | # ------ 10 | # hooks.allowunannotated 11 | # This boolean sets whether unannotated tags will be allowed into the 12 | # repository. By default they won't be. 13 | # hooks.allowdeletetag 14 | # This boolean sets whether deleting tags will be allowed in the 15 | # repository. By default they won't be. 16 | # hooks.allowmodifytag 17 | # This boolean sets whether a tag may be modified after creation. By default 18 | # it won't be. 19 | # hooks.allowdeletebranch 20 | # This boolean sets whether deleting branches will be allowed in the 21 | # repository. By default they won't be. 22 | # hooks.denycreatebranch 23 | # This boolean sets whether remotely creating branches will be denied 24 | # in the repository. By default this is allowed. 25 | # 26 | 27 | # --- Command line 28 | refname="$1" 29 | oldrev="$2" 30 | newrev="$3" 31 | 32 | # --- Safety check 33 | if [ -z "$GIT_DIR" ]; then 34 | echo "Don't run this script from the command line." >&2 35 | echo " (if you want, you could supply GIT_DIR then run" >&2 36 | echo " $0 )" >&2 37 | exit 1 38 | fi 39 | 40 | if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then 41 | echo "usage: $0 " >&2 42 | exit 1 43 | fi 44 | 45 | # --- Config 46 | allowunannotated=$(git config --bool hooks.allowunannotated) 47 | allowdeletebranch=$(git config --bool hooks.allowdeletebranch) 48 | denycreatebranch=$(git config --bool hooks.denycreatebranch) 49 | allowdeletetag=$(git config --bool hooks.allowdeletetag) 50 | allowmodifytag=$(git config --bool hooks.allowmodifytag) 51 | 52 | # check for no description 53 | projectdesc=$(sed -e '1q' "$GIT_DIR/description") 54 | case "$projectdesc" in 55 | "Unnamed repository"* | "") 56 | echo "*** Project description file hasn't been set" >&2 57 | exit 1 58 | ;; 59 | esac 60 | 61 | # --- Check types 62 | # if $newrev is 0000...0000, it's a commit to delete a ref. 63 | zero="0000000000000000000000000000000000000000" 64 | if [ "$newrev" = "$zero" ]; then 65 | newrev_type=delete 66 | else 67 | newrev_type=$(git cat-file -t $newrev) 68 | fi 69 | 70 | case "$refname","$newrev_type" in 71 | refs/tags/*,commit) 72 | # un-annotated tag 73 | short_refname=${refname##refs/tags/} 74 | if [ "$allowunannotated" != "true" ]; then 75 | echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 76 | echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 77 | exit 1 78 | fi 79 | ;; 80 | refs/tags/*,delete) 81 | # delete tag 82 | if [ "$allowdeletetag" != "true" ]; then 83 | echo "*** Deleting a tag is not allowed in this repository" >&2 84 | exit 1 85 | fi 86 | ;; 87 | refs/tags/*,tag) 88 | # annotated tag 89 | if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 90 | then 91 | echo "*** Tag '$refname' already exists." >&2 92 | echo "*** Modifying a tag is not allowed in this repository." >&2 93 | exit 1 94 | fi 95 | ;; 96 | refs/heads/*,commit) 97 | # branch 98 | if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then 99 | echo "*** Creating a branch is not allowed in this repository" >&2 100 | exit 1 101 | fi 102 | ;; 103 | refs/heads/*,delete) 104 | # delete branch 105 | if [ "$allowdeletebranch" != "true" ]; then 106 | echo "*** Deleting a branch is not allowed in this repository" >&2 107 | exit 1 108 | fi 109 | ;; 110 | refs/remotes/*,commit) 111 | # tracking branch 112 | ;; 113 | refs/remotes/*,delete) 114 | # delete tracking branch 115 | if [ "$allowdeletebranch" != "true" ]; then 116 | echo "*** Deleting a tracking branch is not allowed in this repository" >&2 117 | exit 1 118 | fi 119 | ;; 120 | *) 121 | # Anything else (is there anything else?) 122 | echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 123 | exit 1 124 | ;; 125 | esac 126 | 127 | # --- Finished 128 | exit 0 129 | -------------------------------------------------------------------------------- /icons and ui.xar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons and ui.xar -------------------------------------------------------------------------------- /icons/android/icons/icon_114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_114.png -------------------------------------------------------------------------------- /icons/android/icons/icon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_120.png -------------------------------------------------------------------------------- /icons/android/icons/icon_144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_144.png -------------------------------------------------------------------------------- /icons/android/icons/icon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_152.png -------------------------------------------------------------------------------- /icons/android/icons/icon_192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_192.png -------------------------------------------------------------------------------- /icons/android/icons/icon_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_48.png -------------------------------------------------------------------------------- /icons/android/icons/icon_57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_57.png -------------------------------------------------------------------------------- /icons/android/icons/icon_72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_72.png -------------------------------------------------------------------------------- /icons/android/icons/icon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_76.png -------------------------------------------------------------------------------- /icons/android/icons/icon_96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/android/icons/icon_96.png -------------------------------------------------------------------------------- /icons/ios/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/Default-568h@2x.png -------------------------------------------------------------------------------- /icons/ios/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/Default-Landscape.png -------------------------------------------------------------------------------- /icons/ios/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/Default-Portrait.png -------------------------------------------------------------------------------- /icons/ios/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/Default.png -------------------------------------------------------------------------------- /icons/ios/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/Default@2x.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_114.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_120.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_144.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_152.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_192.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_48.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_512.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_57.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_72.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_76.png -------------------------------------------------------------------------------- /icons/ios/icons/icon_96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/icons/ios/icons/icon_96.png -------------------------------------------------------------------------------- /info/exclude: -------------------------------------------------------------------------------- 1 | # git ls-files --others --exclude-from=.git/info/exclude 2 | # Lines that start with '#' are comments. 3 | # For a project mostly in C, the following would be a good set of 4 | # exclude patterns (uncomment them if you want to use them): 5 | # *.[oa] 6 | # *~ 7 | -------------------------------------------------------------------------------- /lib/starling.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/lib/starling.swc -------------------------------------------------------------------------------- /obj/ParticleDesignerConfig.old: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18.0 6 | 7 | 8 | CONFIG::debug 9 | true 10 | 11 | 12 | CONFIG::release 13 | false 14 | 15 | 16 | CONFIG::timeStamp 17 | '1/11/2016' 18 | 19 | 20 | CONFIG::air 21 | true 22 | 23 | 24 | CONFIG::mobile 25 | true 26 | 27 | 28 | CONFIG::desktop 29 | false 30 | 31 | true 32 | 33 | C:\work\ParticleDesigner\src 34 | C:\Program Files (x86)\FlashDevelop\Library\AS3\classes 35 | 36 | 37 | C:\work\ParticleDesigner\lib\starling.swc 38 | 39 | 40 | 41 | C:\work\ParticleDesigner\src\com\cosmindolha\particledesigner\Main.as 42 | 43 | #000000 44 | 60 45 | 46 | 1024 47 | 768 48 | 49 | -------------------------------------------------------------------------------- /obj/ParticleDesignerConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18.0 6 | 7 | 8 | CONFIG::debug 9 | true 10 | 11 | 12 | CONFIG::release 13 | false 14 | 15 | 16 | CONFIG::timeStamp 17 | '1/11/2016' 18 | 19 | 20 | CONFIG::air 21 | true 22 | 23 | 24 | CONFIG::mobile 25 | true 26 | 27 | 28 | CONFIG::desktop 29 | false 30 | 31 | true 32 | 33 | C:\work\ParticleDesigner\src 34 | C:\Program Files (x86)\FlashDevelop\Library\AS3\classes 35 | 36 | 37 | C:\work\ParticleDesigner\lib\starling.swc 38 | 39 | 40 | 41 | C:\work\ParticleDesigner\src\com\cosmindolha\particledesigner\Main.as 42 | 43 | #000000 44 | 60 45 | 46 | 1024 47 | 768 48 | 49 | -------------------------------------------------------------------------------- /particles blubs.xar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/particles blubs.xar -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/Main.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner 2 | { 3 | import flash.desktop.NativeApplication; 4 | import flash.events.Event; 5 | import flash.display.Sprite; 6 | import flash.display.StageAlign; 7 | import flash.display.StageScaleMode; 8 | import flash.geom.Rectangle; 9 | import starling.utils.RectangleUtil; 10 | import starling.utils.ScaleMode; 11 | import flash.ui.Multitouch; 12 | import flash.ui.MultitouchInputMode; 13 | import starling.core.Starling; 14 | 15 | 16 | 17 | 18 | /** 19 | * ... 20 | * @author cosmin dolha 21 | */ 22 | public class Main extends Sprite 23 | { 24 | private var starlingPartDesigner:Starling; 25 | 26 | public function Main() 27 | { 28 | 29 | stage.align = StageAlign.TOP_LEFT; 30 | stage.scaleMode = StageScaleMode.NO_SCALE; 31 | //stage.addEventListener(Event.DEACTIVATE, deactivate); 32 | 33 | stage.addEventListener(Event.RESIZE, resizeStage); 34 | // touch or gesture? 35 | Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT; 36 | 37 | 38 | Starling.handleLostContext = true; 39 | 40 | 41 | starlingPartDesigner = new Starling(ParticleScreen, stage); 42 | starlingPartDesigner.start(); 43 | 44 | 45 | //starlingPartDesigner.showStatsAt( "left", "bottom", 1); 46 | 47 | 48 | } 49 | 50 | protected function resizeStage(event:Event):void 51 | { 52 | fit(); 53 | } 54 | protected function fit():void 55 | { 56 | 57 | var viewPortRectangle:Rectangle = RectangleUtil.fit( 58 | new Rectangle(0, 0, stage.stageWidth, stage.stageHeight), 59 | new Rectangle(0, 0, stage.stageWidth, stage.stageHeight), 60 | ScaleMode.SHOW_ALL); 61 | 62 | Starling.current.viewPort = viewPortRectangle; 63 | 64 | Starling.current.stage.stageWidth = stage.stageWidth; 65 | Starling.current.stage.stageHeight = stage.stageHeight; 66 | } 67 | private function deactivate(e:Event):void 68 | { 69 | // make sure the app behaves well (or exits) when in background 70 | NativeApplication.nativeApplication.exit(); 71 | } 72 | 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/Resource.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner 2 | { 3 | import flash.events.TimerEvent; 4 | import flash.filesystem.File; 5 | 6 | import starling.events.Event; 7 | import starling.utils.AssetManager; 8 | import starling.core.Starling; 9 | 10 | /** 11 | * ... 12 | * @author ... Cosmin Dolha ~ contact@cosmindolha.com 13 | */ 14 | public class Resource 15 | { 16 | public var assets:AssetManager; 17 | 18 | private var disp:DataDispatcher; 19 | 20 | public function Resource(dd:DataDispatcher) 21 | { 22 | disp = dd; 23 | 24 | assets = new AssetManager(); 25 | 26 | assets.keepAtlasXmls = true; 27 | 28 | var appDir:File = File.applicationDirectory; 29 | 30 | assets.enqueue(appDir.resolvePath("assets")); 31 | 32 | assets.addEventListener(Event.IO_ERROR, onError) 33 | 34 | assets.loadQueue(function(ratio:Number):void 35 | { 36 | if (ratio == 1.0) 37 | { 38 | //trace("asstes loaded"); 39 | disp.assetsLoaded(); 40 | } 41 | }); 42 | } 43 | 44 | private function onError(e:Event):void 45 | { 46 | trace("resource error, ", e.data); 47 | } 48 | 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/ChangeBlendEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class ChangeBlendEvent extends Event 10 | { 11 | public var customData:Object; 12 | public static const SET_BLEND_COLOR:String = "setblendcolor"; 13 | public static const SET_BLEND_KNOB:String = "setblendknob"; 14 | 15 | 16 | public function ChangeBlendEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 17 | { 18 | this.customData = customData; 19 | super(type, bubbles, cancelable); 20 | } 21 | override public function clone():Event 22 | { 23 | return new ColorPickerEvent(type, customData, bubbles, cancelable); 24 | } 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/ColorPickerEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class ColorPickerEvent extends Event 10 | { 11 | public var customData:Object; 12 | public static const SET_COLOR:String = "setcolor"; 13 | 14 | 15 | public function ColorPickerEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | override public function clone():Event 21 | { 22 | return new ColorPickerEvent(type, customData, bubbles, cancelable); 23 | } 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/CurrentButtonEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class CurrentButtonEvent extends Event 10 | { 11 | 12 | public var customData:Object; 13 | public static const SELECTED_BUTTON:String = "selectedbutton"; 14 | 15 | public function CurrentButtonEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | 21 | override public function clone():Event 22 | { 23 | return new CurrentButtonEvent(type, customData, bubbles, cancelable); 24 | } 25 | 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/CurrentColorButtonEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class CurrentColorButtonEvent extends Event 10 | { 11 | 12 | public var customData:Object; 13 | public static const SELECTED_COLOR_BUTTON:String = "selectedcolorbutton"; 14 | 15 | public function CurrentColorButtonEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | 21 | override public function clone():Event 22 | { 23 | return new CurrentButtonEvent(type, customData, bubbles, cancelable); 24 | } 25 | 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/CurrentMenuButtonEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class CurrentMenuButtonEvent extends Event 10 | { 11 | 12 | public var customData:Object; 13 | public static const SELECTED_MENU_BUTTON:String = "selectedmenubutton"; 14 | 15 | public function CurrentMenuButtonEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | 21 | override public function clone():Event 22 | { 23 | return new CurrentMenuButtonEvent(type, customData, bubbles, cancelable); 24 | } 25 | 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/CurrentValEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class CurrentValEvent extends Event 10 | { 11 | 12 | public var customData:Object; 13 | public static const UI_VALUE:String = "uivalue"; 14 | 15 | public function CurrentValEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | 21 | override public function clone():Event 22 | { 23 | return new CurrentValEvent(type, customData, bubbles, cancelable); 24 | } 25 | 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/LayerEvents.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class LayerEvents extends Event 10 | { 11 | 12 | public var customData:Object; 13 | public static const NEW_LAYER:String = "newLayer"; 14 | public static const REMOVE_LAYER:String = "removeLayer"; 15 | public static const CHANGE_LAYER:String = "changeLayer"; 16 | public static const CHANGE_LAYER_VISIBILITY:String = "changeLayerVisibility"; 17 | 18 | public static const START_DRAG_LAYER:String = "startDragLayer"; 19 | public static const CHANGE_INDEX:String = "changeIndex"; 20 | 21 | public function LayerEvents(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 22 | { 23 | this.customData = customData; 24 | super(type, bubbles, cancelable); 25 | } 26 | 27 | override public function clone():Event 28 | { 29 | return new LayerEvents(type, customData, bubbles, cancelable); 30 | } 31 | 32 | 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/MoveParticleEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | import flash.geom.Point; 9 | 10 | public class MoveParticleEvent extends Event 11 | { 12 | 13 | public var customData:Point; 14 | public static const ON_PARTICLE_MOVE:String = "onParticleMove"; 15 | 16 | public function MoveParticleEvent(type:String, customData:Point, bubbles:Boolean = false, cancelable:Boolean = false):void 17 | { 18 | this.customData = customData; 19 | super(type, bubbles, cancelable); 20 | } 21 | 22 | override public function clone():Event 23 | { 24 | return new MoveParticleEvent(type, customData, bubbles, cancelable); 25 | } 26 | 27 | 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/PictureEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class PictureEvent extends Event 10 | { 11 | public var customData:Object; 12 | 13 | public static const OPEN_PICTURE_GALLERY:String = "openPictureGallery"; 14 | public static const PICTURE_PICKED:String = "picturePicked"; 15 | public function PictureEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | 21 | override public function clone():Event 22 | { 23 | return new TextureEvent(type, customData, bubbles, cancelable); 24 | } 25 | 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/SetColorPickerEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class SetColorPickerEvent extends Event 10 | { 11 | 12 | public var customData:Object; 13 | public static const SET_COLOR_PICKER:String = "setcolorpicker"; 14 | 15 | public function SetColorPickerEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | 21 | override public function clone():Event 22 | { 23 | return new SetColorPickerEvent(type, customData, bubbles, cancelable); 24 | } 25 | 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/SetDataEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class SetDataEvent extends Event 10 | { 11 | 12 | public var customData:Object; 13 | public static const DATA_SET:String = "dataset"; 14 | 15 | public function SetDataEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | 21 | override public function clone():Event 22 | { 23 | return new SetDataEvent(type, customData, bubbles, cancelable); 24 | } 25 | 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/SetKnobEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class SetKnobEvent extends Event 10 | { 11 | 12 | public var customData:Object; 13 | public static const SET_KNOB:String = "setknob"; 14 | 15 | public function SetKnobEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | 21 | override public function clone():Event 22 | { 23 | return new SetKnobEvent(type, customData, bubbles, cancelable); 24 | } 25 | 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/TextureEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class TextureEvent extends Event 10 | { 11 | public var customData:Object; 12 | 13 | public static const OPEN_GALLERY:String = "openGallery"; 14 | public static const TEXTURE_PICKED:String = "texturePicked"; 15 | public function TextureEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | 21 | override public function clone():Event 22 | { 23 | return new TextureEvent(type, customData, bubbles, cancelable); 24 | } 25 | 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/UpdateLayerPreviewEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class UpdateLayerPreviewEvent extends Event 10 | { 11 | public var customData:Object; 12 | public static const UPDATE_LAYER_PREVIEW:String = "updatelayerpreview"; 13 | 14 | 15 | 16 | public function UpdateLayerPreviewEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 17 | { 18 | this.customData = customData; 19 | super(type, bubbles, cancelable); 20 | } 21 | override public function clone():Event 22 | { 23 | return new UpdateLayerPreviewEvent(type, customData, bubbles, cancelable); 24 | } 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/events/XmlLoadedEvent.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.events 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import flash.events.Event; 8 | 9 | public class XmlLoadedEvent extends Event 10 | { 11 | public var customData:Object; 12 | public static const XML_LOADED:String = "xmlLoaded"; 13 | 14 | 15 | public function XmlLoadedEvent(type:String, customData:Object, bubbles:Boolean = false, cancelable:Boolean = false):void 16 | { 17 | this.customData = customData; 18 | super(type, bubbles, cancelable); 19 | } 20 | override public function clone():Event 21 | { 22 | return new XmlLoadedEvent(type, customData, bubbles, cancelable); 23 | } 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/ui/Button.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.ui 2 | { 3 | import com.cosmindolha.particledesigner.DataDispatcher; 4 | import com.cosmindolha.particledesigner.Resource; 5 | import flash.display.BitmapData; 6 | import starling.display.Image; 7 | import starling.display.Sprite; 8 | import starling.events.Event; 9 | import starling.events.Touch; 10 | import starling.events.TouchEvent; 11 | import starling.events.TouchPhase; 12 | import starling.text.TextField; 13 | import starling.text.TextFieldAutoSize; 14 | import starling.textures.Texture; 15 | import starling.utils.*; 16 | // import starling.text.TextFormat; 17 | 18 | /** 19 | * ... 20 | * @author cosmin dolha 21 | */ 22 | public class Button extends Sprite 23 | { 24 | private var labelField:TextField; 25 | private var margin:int; 26 | private var sp:Sprite; 27 | private var dispatcher:DataDispatcher; 28 | private var sendObject:Object; 29 | private var id:int; 30 | private var toogleIMG:Image; 31 | 32 | private var toggleable:Boolean; 33 | private var onOff:Boolean; 34 | 35 | 36 | //public var toogleEnabled:Boolean; 37 | public function Button(dd:DataDispatcher, iD:int) 38 | { 39 | 40 | dispatcher = dd; 41 | id = iD; 42 | sp = new Sprite(); 43 | addChild(sp); 44 | sp.alpha = .3; 45 | 46 | labelField = new TextField(100, 40, "", "abel", 14, Color.WHITE, true); 47 | 48 | //starling 2 49 | //var format:TextFormat = new TextFormat( "abel", 14, Color.WHITE, "left"); 50 | 51 | //labelField = new TextField(100, 40, "", format); 52 | //starling 2 53 | 54 | labelField.hAlign = HAlign.LEFT; 55 | labelField.autoSize = TextFieldAutoSize.HORIZONTAL; 56 | addChild(labelField); 57 | 58 | addEventListener(Event.ADDED_TO_STAGE, added); 59 | margin = 5; 60 | labelField.x = margin; 61 | labelField.y = 3; 62 | 63 | addEventListener(TouchEvent.TOUCH, onTouch); 64 | 65 | } 66 | public function set toogleEnabled(t:Boolean):void 67 | { 68 | toggleable = t; 69 | 70 | } 71 | 72 | public function switchToggle():void 73 | { 74 | onOff = !onOff; 75 | 76 | sp.alpha = onOff ? 1 : 0.3; 77 | 78 | } 79 | public function deselect():void 80 | { 81 | if (toggleable == false) sp.alpha = 0.3; 82 | } 83 | public function select():void 84 | { 85 | if (toggleable == false) sp.alpha = 1; 86 | } 87 | private function onTouch(e:TouchEvent):void 88 | { 89 | 90 | var downTouch:Touch = e.getTouch(stage, TouchPhase.BEGAN); 91 | var upTouch:Touch = e.getTouch(stage, TouchPhase.ENDED); 92 | 93 | if (downTouch != null) 94 | { 95 | if (toggleable == false) sp.alpha = 1; 96 | if (toggleable) switchToggle(); 97 | } 98 | if (upTouch != null) 99 | { 100 | if (toggleable == false) sp.alpha = 0.3; 101 | sendObject = new Object(); 102 | sendObject.bt = this; 103 | sendObject.id = id; 104 | sendObject.toggleable = toggleable; 105 | if (toggleable) sendObject.onOff = onOff; 106 | 107 | dispatcher.buttonClicked(sendObject) 108 | } 109 | 110 | } 111 | private function added(e:Event):void 112 | { 113 | var img:Image = new Image(buttonBitmap()); 114 | 115 | 116 | sp.addChild(img); 117 | 118 | } 119 | public function set text(txt:String):void 120 | { 121 | labelField.text = txt; 122 | } 123 | private function buttonBitmap():Texture 124 | { 125 | var sp:flash.display.Sprite = new flash.display.Sprite(); 126 | sp.graphics.beginFill(0x8081ff, .8); 127 | sp.graphics.drawRoundRect(0, 0, 70, 40, 5, 5); 128 | sp.graphics.endFill(); 129 | 130 | var bmpData:BitmapData = new BitmapData(sp.width, sp.height, true, 0x00000000); 131 | bmpData.draw(sp); 132 | var texture:Texture = Texture.fromBitmapData(bmpData, false, false); 133 | return texture; 134 | 135 | } 136 | } 137 | 138 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/ui/ButtonLayers.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.ui 2 | { 3 | import starling.display.Sprite; 4 | import starling.events.Event; 5 | 6 | import starling.utils.*; 7 | import flash.display.BitmapData; 8 | import starling.textures.Texture; 9 | import starling.display.Image; 10 | import starling.events.Touch; 11 | import starling.events.TouchEvent; 12 | import starling.events.TouchPhase; 13 | import com.cosmindolha.particledesigner.DataDispatcher; 14 | 15 | 16 | 17 | /** 18 | * ... 19 | * @author cosmin dolha 20 | */ 21 | public class ButtonLayers extends Sprite 22 | { 23 | 24 | private var margin:int; 25 | private var sp:Sprite; 26 | private var dispatcher:DataDispatcher; 27 | private var sendObject:Object; 28 | private var id:int; 29 | public function ButtonLayers(dd:DataDispatcher, iD:int) 30 | { 31 | dispatcher = dd; 32 | id = iD; 33 | sp = new Sprite(); 34 | addChild(sp); 35 | sp.alpha = .3; 36 | 37 | addEventListener(TouchEvent.TOUCH, onTouch); 38 | 39 | var img:Image = new Image(buttonBitmap()); 40 | 41 | 42 | sp.addChild(img); 43 | 44 | } 45 | public function deselect():void 46 | { 47 | sp.alpha = 0.3; 48 | } 49 | public function select():void 50 | { 51 | sp.alpha = 1; 52 | } 53 | private function onTouch(e:TouchEvent):void 54 | { 55 | 56 | var downTouch:Touch = e.getTouch(stage, TouchPhase.BEGAN); 57 | var upTouch:Touch = e.getTouch(stage, TouchPhase.ENDED); 58 | 59 | if (downTouch != null) 60 | { 61 | sp.alpha = 1; 62 | dispatchEvent(new Event("buttonLayerClicked")); 63 | } 64 | if (upTouch != null) 65 | { 66 | sp.alpha = 0.3; 67 | } 68 | 69 | } 70 | 71 | 72 | private function buttonBitmap():Texture 73 | { 74 | var sp:flash.display.Sprite = new flash.display.Sprite(); 75 | sp.graphics.beginFill(0x000000, .8); 76 | sp.graphics.drawRect(0, 0, 40, 40); 77 | sp.graphics.endFill(); 78 | 79 | var bmpData:BitmapData = new BitmapData(sp.width, sp.height, true, 0x00000000); 80 | bmpData.draw(sp); 81 | var texture:Texture = Texture.fromBitmapData(bmpData, false, false); 82 | return texture; 83 | 84 | } 85 | } 86 | 87 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/ui/ColorButton.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.ui 2 | { 3 | import starling.display.Sprite; 4 | import starling.events.Event; 5 | import starling.text.TextField; 6 | import starling.text.TextFieldAutoSize; 7 | //import starling.text.TextFormat; 8 | import starling.utils.*; 9 | import flash.display.BitmapData; 10 | import starling.textures.Texture; 11 | import starling.display.Image; 12 | import starling.events.Touch; 13 | import starling.events.TouchEvent; 14 | import starling.events.TouchPhase; 15 | import com.cosmindolha.particledesigner.DataDispatcher; 16 | 17 | /** 18 | * ... 19 | * @author cosmin dolha 20 | */ 21 | public class ColorButton extends Sprite 22 | { 23 | private var labelField:TextField; 24 | private var margin:int; 25 | private var sp:Sprite; 26 | private var dispatcher:DataDispatcher; 27 | private var sendObject:Object; 28 | private var id:int; 29 | public function ColorButton(dd:DataDispatcher, iD:int) 30 | { 31 | dispatcher = dd; 32 | id = iD; 33 | sp = new Sprite(); 34 | addChild(sp); 35 | sp.alpha = .3; 36 | 37 | 38 | 39 | labelField = new TextField(100, 40, "", "abel", 14, Color.WHITE, true); 40 | 41 | //starling 2 42 | //var format:TextFormat = new TextFormat( "abel", 14, Color.WHITE, "left"); 43 | 44 | //labelField = new TextField(100, 40, "", format); 45 | //starling 2 46 | 47 | // 48 | labelField.hAlign = HAlign.LEFT; 49 | labelField.autoSize = TextFieldAutoSize.HORIZONTAL; 50 | addChild(labelField); 51 | 52 | addEventListener(Event.ADDED_TO_STAGE, added); 53 | margin = 5; 54 | labelField.x = margin; 55 | labelField.y = 3; 56 | 57 | addEventListener(TouchEvent.TOUCH, onTouch); 58 | 59 | 60 | } 61 | public function deselect():void 62 | { 63 | sp.alpha = 0.3; 64 | } 65 | public function select():void 66 | { 67 | sp.alpha = 1; 68 | } 69 | private function onTouch(e:TouchEvent):void 70 | { 71 | 72 | var downTouch:Touch = e.getTouch(stage, TouchPhase.BEGAN); 73 | var upTouch:Touch = e.getTouch(stage, TouchPhase.ENDED); 74 | 75 | if (downTouch != null) 76 | { 77 | sp.alpha = 1; 78 | 79 | 80 | 81 | } 82 | if (upTouch != null) 83 | { 84 | sp.alpha = 0.3; 85 | sendObject = new Object(); 86 | sendObject.bt = this; 87 | sendObject.id = id; 88 | dispatcher.buttonColorClicked(sendObject) 89 | } 90 | 91 | } 92 | private function added(e:Event):void 93 | { 94 | var img:Image = new Image(buttonBitmap()); 95 | 96 | 97 | sp.addChild(img); 98 | sp.blendMode = "screen"; 99 | } 100 | public function set text(txt:String):void 101 | { 102 | labelField.text = txt; 103 | } 104 | private function buttonBitmap():Texture 105 | { 106 | var sp:flash.display.Sprite = new flash.display.Sprite(); 107 | sp.graphics.beginFill(0xbf00bd, .8); 108 | sp.graphics.drawRoundRect(0, 0, 70, 40, 5, 5); 109 | sp.graphics.endFill(); 110 | 111 | var bmpData:BitmapData = new BitmapData(sp.width, sp.height, true, 0x00000000); 112 | bmpData.draw(sp); 113 | var texture:Texture = Texture.fromBitmapData(bmpData, false, false); 114 | return texture; 115 | 116 | } 117 | } 118 | 119 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/ui/PictureHolder.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.ui 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import starling.display.Sprite; 8 | import flash.display.BitmapData; 9 | import com.cosmindolha.particledesigner.DataDispatcher; 10 | import com.cosmindolha.particledesigner.Resource; 11 | import starling.display.Sprite; 12 | import starling.display.Image; 13 | import starling.textures.Texture; 14 | import starling.events.Touch; 15 | import starling.events.TouchEvent; 16 | import starling.events.TouchPhase; 17 | 18 | public class PictureHolder extends Sprite 19 | { 20 | private var dispatcher:DataDispatcher; 21 | private var resources:Resource; 22 | private var layerID:int; 23 | private var texture:String; 24 | private var sendObject:Object; 25 | private var bgImage:Image; 26 | 27 | public function PictureHolder(dd:DataDispatcher, rs:Resource, id:int, tx:String) 28 | { 29 | 30 | dispatcher = dd; 31 | resources = rs; 32 | layerID = id; 33 | texture = tx; 34 | 35 | sendObject = new Object(); 36 | 37 | sendObject.layerID = id; 38 | sendObject.texture = tx; 39 | 40 | 41 | bgImage = new Image(buttonBitmap()); 42 | var textureImage:Image = new Image(resources.assets.getTexture(tx)); 43 | 44 | textureImage.pivotX = textureImage.width / 2; 45 | textureImage.pivotY = textureImage.height / 2; 46 | 47 | bgImage.pivotX = bgImage.width / 2; 48 | bgImage.pivotY = bgImage.height / 2; 49 | bgImage.alpha = 0.2; 50 | 51 | if (textureImage.width > textureImage.height) 52 | { 53 | textureImage.width = 50; 54 | textureImage.scaleY = textureImage.scaleX; 55 | }else { 56 | textureImage.height = 50; 57 | textureImage.scaleX = textureImage.scaleY; 58 | } 59 | 60 | addChild(bgImage); 61 | addChild(textureImage); 62 | addEventListener(TouchEvent.TOUCH, onTouch); 63 | 64 | 65 | } 66 | private function onTouch(e:TouchEvent):void 67 | { 68 | var upTouch:Touch = e.getTouch(stage, TouchPhase.ENDED); 69 | if (upTouch != null) 70 | { 71 | bgImage.alpha = .2; 72 | 73 | dispatcher.picturePicked(sendObject); 74 | } 75 | var downTouch:Touch = e.getTouch(stage, TouchPhase.BEGAN); 76 | 77 | if (downTouch != null) 78 | { 79 | bgImage.alpha = 1; 80 | } 81 | } 82 | 83 | private function buttonBitmap():Texture 84 | { 85 | var sp:flash.display.Sprite = new flash.display.Sprite(); 86 | sp.graphics.beginFill(0x8081ff, .8); 87 | sp.graphics.drawRoundRect(0, 0, 70, 70, 5, 5); 88 | sp.graphics.endFill(); 89 | 90 | var bmpData:BitmapData = new BitmapData(sp.width, sp.height, true, 0x00000000); 91 | bmpData.draw(sp); 92 | sp.graphics.clear(); 93 | sp = null; 94 | var texture:Texture = Texture.fromBitmapData(bmpData, false, false); 95 | return texture; 96 | 97 | } 98 | } 99 | 100 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/ui/PicturePicker.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.ui 2 | { 3 | import com.cosmindolha.particledesigner.DataDispatcher; 4 | import com.cosmindolha.particledesigner.Resource; 5 | import starling.display.Quad; 6 | import starling.display.Sprite; 7 | import starling.events.Event; 8 | import starling.textures.Texture; 9 | /** 10 | * ... 11 | * @author cosmin dolha 12 | */ 13 | public class PicturePicker extends Sprite 14 | { 15 | private var dispatcher:DataDispatcher; 16 | private var resources:Resource; 17 | private var textureArray:Array; 18 | 19 | public function PicturePicker(dd:DataDispatcher, rs:Resource) 20 | { 21 | dispatcher = dd; 22 | resources = rs; 23 | 24 | addEventListener(Event.ADDED_TO_STAGE, onAdded); 25 | 26 | textureArray = new Array(); 27 | textureArray.push("parrot"); 28 | textureArray.push("bomb"); 29 | textureArray.push("pic"); 30 | textureArray.push("angulex"); 31 | 32 | 33 | 34 | } 35 | private function onAdded(e:Event):void 36 | { 37 | var bg:Quad = new Quad(stage.stageWidth, stage.stageHeight, 0x000000); 38 | bg.alpha = 0.9; 39 | addChild(bg); 40 | 41 | buildGallery(); 42 | } 43 | private function buildGallery():void 44 | { 45 | 46 | var spacerX:int = 80; 47 | var spacerY:int = 80; 48 | var margin:int = 100; 49 | 50 | var toX:int = margin+spacerX; 51 | var toY:int = 150+spacerY; 52 | 53 | 54 | for (var i:int = 0; i < textureArray.length; i++) 55 | { 56 | var texture:String = textureArray[i]; 57 | 58 | var textureHolder:PictureHolder = new PictureHolder(dispatcher, resources, i, texture); 59 | addChild(textureHolder); 60 | textureHolder.x = toX; 61 | textureHolder.y = toY; 62 | if (toX > stage.stageWidth-margin-spacerX*2) 63 | { 64 | toX = margin+spacerX; 65 | toY += spacerY; 66 | }else { 67 | toX += spacerX; 68 | } 69 | } 70 | } 71 | 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/ui/RightMenuButton.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.ui 2 | { 3 | import starling.display.Sprite; 4 | import starling.events.Event; 5 | import starling.text.TextField; 6 | // import starling.text.TextFormat; 7 | import starling.text.TextFieldAutoSize; 8 | import starling.utils.*; 9 | import flash.display.BitmapData; 10 | import starling.textures.Texture; 11 | import starling.display.Image; 12 | import starling.events.Touch; 13 | import starling.events.TouchEvent; 14 | import starling.events.TouchPhase; 15 | import com.cosmindolha.particledesigner.DataDispatcher; 16 | 17 | /** 18 | * ... 19 | * @author cosmin dolha 20 | */ 21 | public class RightMenuButton extends Sprite 22 | { 23 | private var labelField:TextField; 24 | private var margin:int; 25 | private var sp:Sprite; 26 | private var dispatcher:DataDispatcher; 27 | private var sendObject:Object; 28 | private var id:int; 29 | public function RightMenuButton(dd:DataDispatcher, iD:int, label:String) 30 | { 31 | dispatcher = dd; 32 | id = iD; 33 | sp = new Sprite(); 34 | addChild(sp); 35 | sp.alpha = .3; 36 | labelField = new TextField(100, 40, "", "abel", 14, Color.WHITE, true); 37 | labelField.hAlign = HAlign.CENTER; 38 | 39 | 40 | //starling 2 41 | //var format:TextFormat = new TextFormat("abel", 14, Color.WHITE, "left"); 42 | 43 | //labelField = new TextField(100, 40, "", format); 44 | //starling 2 45 | 46 | // 47 | 48 | labelField.autoSize = TextFieldAutoSize.HORIZONTAL; 49 | addChild(labelField); 50 | labelField.text = label; 51 | addEventListener(Event.ADDED_TO_STAGE, added); 52 | margin = 5; 53 | labelField.x = margin; 54 | labelField.y = 3; 55 | 56 | addEventListener(TouchEvent.TOUCH, onTouch); 57 | 58 | 59 | } 60 | public function deselect():void 61 | { 62 | sp.alpha = 0.3; 63 | } 64 | public function select():void 65 | { 66 | sp.alpha = 1; 67 | } 68 | private function onTouch(e:TouchEvent):void 69 | { 70 | 71 | var downTouch:Touch = e.getTouch(stage, TouchPhase.BEGAN); 72 | var upTouch:Touch = e.getTouch(stage, TouchPhase.ENDED); 73 | 74 | if (downTouch != null) 75 | { 76 | sp.alpha = 1; 77 | 78 | 79 | 80 | } 81 | if (upTouch != null) 82 | { 83 | sp.alpha = 0.3; 84 | sendObject = new Object(); 85 | sendObject.bt = this; 86 | sendObject.id = id; 87 | dispatcher.menuClicked(sendObject) 88 | } 89 | 90 | } 91 | private function added(e:Event):void 92 | { 93 | var img:Image = new Image(buttonBitmap()); 94 | 95 | 96 | sp.addChild(img); 97 | 98 | 99 | } 100 | 101 | private function buttonBitmap():Texture 102 | { 103 | var sp:flash.display.Sprite = new flash.display.Sprite(); 104 | sp.graphics.beginFill(0xad02c8, .8); 105 | sp.graphics.drawRoundRect(0, 0, 70, 45, 5, 5); 106 | sp.graphics.endFill(); 107 | 108 | var bmpData:BitmapData = new BitmapData(sp.width, sp.height, true, 0x00000000); 109 | bmpData.draw(sp); 110 | var texture:Texture = Texture.fromBitmapData(bmpData, false, false); 111 | return texture; 112 | 113 | } 114 | } 115 | 116 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/ui/TextureHolder.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.ui 2 | { 3 | /** 4 | * ... 5 | * @author cosmin dolha 6 | */ 7 | import starling.display.Sprite; 8 | import flash.display.BitmapData; 9 | import com.cosmindolha.particledesigner.DataDispatcher; 10 | import com.cosmindolha.particledesigner.Resource; 11 | import starling.display.Sprite; 12 | import starling.display.Image; 13 | import starling.textures.Texture; 14 | import starling.events.Touch; 15 | import starling.events.TouchEvent; 16 | import starling.events.TouchPhase; 17 | 18 | public class TextureHolder extends Sprite 19 | { 20 | private var dispatcher:DataDispatcher; 21 | private var resources:Resource; 22 | private var layerID:int; 23 | private var texture:String; 24 | private var sendObject:Object; 25 | private var bgImage:Image; 26 | 27 | public function TextureHolder(dd:DataDispatcher, rs:Resource, id:int, tx:String) 28 | { 29 | 30 | dispatcher = dd; 31 | resources = rs; 32 | layerID = id; 33 | texture = tx; 34 | 35 | sendObject = new Object(); 36 | 37 | sendObject.layerID = id; 38 | sendObject.texture = tx; 39 | 40 | 41 | bgImage = new Image(buttonBitmap()); 42 | var textureImage:Image = new Image(resources.assets.getTexture(tx)); 43 | 44 | textureImage.pivotX = textureImage.width / 2; 45 | textureImage.pivotY = textureImage.height / 2; 46 | 47 | bgImage.pivotX = bgImage.width / 2; 48 | bgImage.pivotY = bgImage.height / 2; 49 | bgImage.alpha = 0.2; 50 | 51 | if (textureImage.width > textureImage.height) 52 | { 53 | textureImage.width = 50; 54 | textureImage.scaleY = textureImage.scaleX; 55 | }else { 56 | textureImage.height = 50; 57 | textureImage.scaleX = textureImage.scaleY; 58 | } 59 | 60 | addChild(bgImage); 61 | addChild(textureImage); 62 | addEventListener(TouchEvent.TOUCH, onTouch); 63 | 64 | 65 | } 66 | private function onTouch(e:TouchEvent):void 67 | { 68 | var upTouch:Touch = e.getTouch(stage, TouchPhase.ENDED); 69 | if (upTouch != null) 70 | { 71 | bgImage.alpha = .2; 72 | 73 | dispatcher.texturePicked(sendObject); 74 | } 75 | var downTouch:Touch = e.getTouch(stage, TouchPhase.BEGAN); 76 | 77 | if (downTouch != null) 78 | { 79 | bgImage.alpha = 1; 80 | } 81 | } 82 | 83 | private function buttonBitmap():Texture 84 | { 85 | var sp:flash.display.Sprite = new flash.display.Sprite(); 86 | sp.graphics.beginFill(0x8081ff, .8); 87 | sp.graphics.drawRoundRect(0, 0, 70, 70, 5, 5); 88 | sp.graphics.endFill(); 89 | 90 | var bmpData:BitmapData = new BitmapData(sp.width, sp.height, true, 0x00000000); 91 | bmpData.draw(sp); 92 | sp.graphics.clear(); 93 | sp = null; 94 | var texture:Texture = Texture.fromBitmapData(bmpData, false, false); 95 | return texture; 96 | 97 | } 98 | } 99 | 100 | } -------------------------------------------------------------------------------- /src/com/cosmindolha/particledesigner/ui/TexturePicker.as: -------------------------------------------------------------------------------- 1 | package com.cosmindolha.particledesigner.ui 2 | { 3 | import com.cosmindolha.particledesigner.DataDispatcher; 4 | import com.cosmindolha.particledesigner.Resource; 5 | import starling.display.Quad; 6 | import starling.display.Sprite; 7 | import starling.events.Event; 8 | import starling.textures.Texture; 9 | /** 10 | * ... 11 | * @author cosmin dolha 12 | */ 13 | public class TexturePicker extends Sprite 14 | { 15 | private var dispatcher:DataDispatcher; 16 | private var resources:Resource; 17 | private var textureArray:Array; 18 | 19 | public function TexturePicker(dd:DataDispatcher, rs:Resource) 20 | { 21 | dispatcher = dd; 22 | resources = rs; 23 | 24 | addEventListener(Event.ADDED_TO_STAGE, onAdded); 25 | 26 | textureArray = new Array(); 27 | textureArray.push("txt1"); 28 | textureArray.push("txt2"); 29 | textureArray.push("txt3"); 30 | textureArray.push("txt4"); 31 | textureArray.push("txt5"); 32 | textureArray.push("txt6"); 33 | textureArray.push("blurb"); 34 | textureArray.push("mathsumrunicon"); 35 | textureArray.push("logo"); 36 | textureArray.push("coin"); 37 | textureArray.push("potion"); 38 | textureArray.push("mathsumrunwriting"); 39 | textureArray.push("f1"); 40 | textureArray.push("f2"); 41 | textureArray.push("f3"); 42 | textureArray.push("f4"); 43 | textureArray.push("f5"); 44 | textureArray.push("f6"); 45 | textureArray.push("smoke1"); 46 | textureArray.push("butterfly"); 47 | textureArray.push("line"); 48 | } 49 | private function onAdded(e:Event):void 50 | { 51 | var bg:Quad = new Quad(stage.stageWidth, stage.stageHeight, 0x000000); 52 | bg.alpha = 0.9; 53 | addChild(bg); 54 | 55 | buildGallery(); 56 | } 57 | private function buildGallery():void 58 | { 59 | 60 | var spacerX:int = 80; 61 | var spacerY:int = 80; 62 | var margin:int = 100; 63 | 64 | var toX:int = margin+spacerX; 65 | var toY:int = 150+spacerY; 66 | 67 | 68 | for (var i:int = 0; i < textureArray.length; i++) 69 | { 70 | var texture:String = textureArray[i]; 71 | 72 | var textureHolder:TextureHolder = new TextureHolder(dispatcher, resources, i, texture); 73 | addChild(textureHolder); 74 | textureHolder.x = toX; 75 | textureHolder.y = toY; 76 | if (toX > stage.stageWidth-margin-spacerX*2) 77 | { 78 | toX = margin+spacerX; 79 | toY += spacerY; 80 | }else { 81 | toX += spacerX; 82 | } 83 | } 84 | } 85 | 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /src/com/gskinner/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/src/com/gskinner/.DS_Store -------------------------------------------------------------------------------- /src/com/gskinner/motion/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/src/com/gskinner/motion/.DS_Store -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Back.as: -------------------------------------------------------------------------------- 1 | /** * Back by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Back { protected static var s:Number = 1.70158; // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return ratio*ratio*((s+1)*ratio-s); } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return (ratio -= 1)*ratio*((s+1)*ratio+s)+1 } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return ((ratio *= 2) < 1) ? 0.5*(ratio*ratio*((s*1.525+1)*ratio-s*1.525)) : 0.5*((ratio -= 2)*ratio*((s*1.525+1)*ratio+s*1.525)+2); } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Bounce.as: -------------------------------------------------------------------------------- 1 | /** * Bounce by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Bounce { // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return 1-easeOut(1-ratio,0,0,0); } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { if (ratio < 1/2.75) { return 7.5625*ratio*ratio; } else if (ratio < 2/2.75) { return 7.5625*(ratio-=1.5/2.75)*ratio+0.75; } else if (ratio < 2.5/2.75) { return 7.5625*(ratio-=2.25/2.75)*ratio+0.9375; } else { return 7.5625*(ratio-=2.625/2.75)*ratio+0.984375; } } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return ((ratio*=2) < 1) ? 0.5*easeIn(ratio,0,0,0) : 0.5*easeOut(ratio-1,0,0,0)+0.5; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Circular.as: -------------------------------------------------------------------------------- 1 | /** * Circular by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Circular { // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return -(Math.sqrt(1-ratio*ratio)-1); } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return Math.sqrt(1-(ratio-1)*(ratio-1)); } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return ((ratio *= 2) < 1) ? -0.5*(Math.sqrt(1-ratio*ratio)-1) : 0.5*(Math.sqrt(1-(ratio-=2)*ratio)+1); } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Cubic.as: -------------------------------------------------------------------------------- 1 | /** * Cubic by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Cubic { // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return ratio*ratio*ratio; } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return (ratio-=1)*ratio*ratio+1; } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return (ratio < 0.5) ? 4*ratio*ratio*ratio : 4*(ratio-=1)*ratio*ratio+1; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Elastic.as: -------------------------------------------------------------------------------- 1 | /** * Elastic by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Elastic { protected static var a:Number=1; protected static var p:Number=0.3; protected static var s:Number=p/4; // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { if (ratio == 0 || ratio == 1) { return ratio; } return -(a * Math.pow(2, 10 * (ratio -= 1)) * Math.sin((ratio - s) * (2 * Math.PI) / p)); } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { if (ratio == 0 || ratio == 1) { return ratio; } return a * Math.pow(2, -10 * ratio) * Math.sin((ratio - s) * (2 * Math.PI) / p) + 1; } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { if (ratio == 0 || ratio == 1) { return ratio; } ratio = ratio*2-1; if (ratio < 0) { return -0.5 * (a * Math.pow(2, 10 * ratio) * Math.sin((ratio - s*1.5) * (2 * Math.PI) /(p*1.5))); } return 0.5 * a * Math.pow(2, -10 * ratio) * Math.sin((ratio - s*1.5) * (2 * Math.PI) / (p*1.5)) + 1; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Exponential.as: -------------------------------------------------------------------------------- 1 | /** * Exponential by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Exponential { // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return (ratio == 0) ? 0 : Math.pow(2, 10 * (ratio - 1)); } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return (ratio == 1) ? 1 : 1-Math.pow(2, -10 * ratio); } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { if (ratio == 0 || ratio == 1) { return ratio; } if (0 > (ratio = ratio*2-1)) { return 0.5*Math.pow(2, 10*ratio); } return 1-0.5*Math.pow(2, -10*ratio); } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Linear.as: -------------------------------------------------------------------------------- 1 | /** * Linear by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Linear { // unused params are included for compatibility with other easing classes. public static function easeNone(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return ratio; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Quadratic.as: -------------------------------------------------------------------------------- 1 | /** * Quadratic by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Quadratic { // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return ratio*ratio; } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return -ratio*(ratio-2); } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return (ratio < 0.5) ? 2*ratio*ratio : -2*ratio*(ratio-2)-1; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Quartic.as: -------------------------------------------------------------------------------- 1 | /** * Quartic by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Quartic { // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return ratio*ratio*ratio*ratio; } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return 1-(ratio-=1)*ratio*ratio*ratio; } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return (ratio < 0.5) ? 8*ratio*ratio*ratio*ratio : -8*(ratio-=1)*ratio*ratio*ratio+1; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Quintic.as: -------------------------------------------------------------------------------- 1 | /** * Quintic by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Quintic { // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return ratio*ratio*ratio*ratio*ratio; } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return 1+(ratio-=1)*ratio*ratio*ratio*ratio; } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return (ratio < 0.5) ? 16*ratio*ratio*ratio*ratio*ratio : 16*(ratio-=1)*ratio*ratio*ratio*ratio+1; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/easing/Sine.as: -------------------------------------------------------------------------------- 1 | /** * Sine by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * Adapted from Robert Penner's AS3 tweening equations. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.easing { /** * Easing class for use with GTween. This ease class is not compatible with other tweening engines. * GTween can use standard t,b,c,d format ease classes. **/ public class Sine { // unused params are included for compatibility with other easing classes. public static function easeIn(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return 1-Math.cos(ratio * (Math.PI / 2)); } public static function easeOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return Math.sin(ratio * (Math.PI / 2)); } public static function easeInOut(ratio:Number, unused1:Number, unused2:Number, unused3:Number):Number { return -0.5*(Math.cos(ratio*Math.PI)-1); } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/plugins/AutoHidePlugin.as: -------------------------------------------------------------------------------- 1 | /** * AutoHidePlugin by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.plugins { import com.gskinner.motion.GTween; import com.gskinner.motion.plugins.IGTweenPlugin; /** * Plugin for GTween. Sets the visible of the target to false if its alpha is 0 or less. *

* Supports the following pluginData properties:
    *
  • AutoHideEnabled: overrides the enabled property for the plugin on a per tween basis. *
**/ public class AutoHidePlugin implements IGTweenPlugin { // Static interface: /** Specifies whether this plugin is enabled for all tweens by default. **/ public static var enabled:Boolean=true; /** @private **/ protected static var instance:AutoHidePlugin; /** @private **/ protected static var tweenProperties:Array = ["alpha"]; /** * Installs this plugin for use with all GTween instances. **/ public static function install():void { if (instance) { return; } instance = new AutoHidePlugin(); GTween.installPlugin(instance,tweenProperties); } // Public methods: /** @private **/ public function init(tween:GTween, name:String, value:Number):Number { return value; } /** @private **/ public function tween(tween:GTween, name:String, value:Number, initValue:Number, rangeValue:Number, ratio:Number, end:Boolean):Number { // only change the visibility if the plugin is enabled: if (((tween.pluginData.AutoHideEnabled == null && enabled) || tween.pluginData.AutoHideEnabled)) { if (tween.target.visible != (value > 0)) { tween.target.visible = (value > 0); } } return value; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/plugins/BlurPlugin.as: -------------------------------------------------------------------------------- 1 | /** * BlurPlugin by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.plugins { import com.gskinner.motion.GTween; import flash.filters.BlurFilter; import com.gskinner.motion.plugins.IGTweenPlugin; /** * Plugin for GTween. Applies a blur filter to the target based on the "blur", "blurX", and/or "blurY" tween values. *

* If a blur filter does not already exist on the tween target, the plugin will create one. * Note that this may conflict with other plugins that use filters. If you experience problems, * try applying a blur filter to the target in advance to avoid this behaviour. *

* Supports the following pluginData properties:
    *
  • BlurEnabled: overrides the enabled property for the plugin on a per tween basis. *
  • BlurData: Used internally. *
**/ public class BlurPlugin implements IGTweenPlugin { // Static interface: /** Specifies whether this plugin is enabled for all tweens by default. **/ public static var enabled:Boolean=true; /** @private **/ protected static var instance:BlurPlugin; /** @private **/ protected static var tweenProperties:Array = ["blurX","blurY","blur"]; /** * Installs this plugin for use with all GTween instances. **/ public static function install():void { if (instance) { return; } instance = new BlurPlugin(); GTween.installPlugin(instance,tweenProperties); } // Public methods: /** @private **/ public function init(tween:GTween, name:String, value:Number):Number { if (!((tween.pluginData.BlurEnabled == null && enabled) || tween.pluginData.BlurEnabled)) { return value; } // try to find a blur filter: var f:Array = tween.target.filters; for (var i:uint=0; i
* Supports the following pluginData properties:
    *
  • ColorTransformEnabled: overrides the enabled property for the plugin on a per tween basis. *
**/ public class ColorTransformPlugin { // Static interface: /** Specifies whether this plugin is enabled for all tweens by default. **/ public static var enabled:Boolean=true; /** @private **/ protected static var installed:Boolean = false; /** @private **/ protected static var tweenProperties:Array = ["redMultiplier","greenMultiplier","blueMultiplier","alphaMultiplier","redOffset","greenOffset","blueOffset","alphaOffset","tint"]; /** * Installs this plugin for use with all GTween instances. **/ public static function install():void { if (installed) { return; } installed = true; GTween.installPlugin(ColorTransformPlugin,tweenProperties,true); } // Public methods: /** @private **/ public static function init(tween:GTween, name:String, value:Number):Number { if (!((enabled && tween.pluginData.ColorTransformEnabled == null) || tween.pluginData.ColorTransformEnabled)) { return value; } if (name == "tint") { // try to calculate initial tint: var ct:ColorTransform = tween.target.transform.colorTransform; var a:uint = Math.min(1,1-ct.redMultiplier); var r:uint = Math.min(0xFF,ct.redOffset*a); var g:uint = Math.min(0xFF,ct.greenOffset*a); var b:uint = Math.min(0xFF,ct.blueOffset*a); var tint:uint = a*0xFF<<24 | r<<16 | g<<8 | b; return tint; } else { return tween.target.transform.colorTransform[name]; } } /** @private **/ public static function tween(tween:GTween, name:String, value:Number, initValue:Number, rangeValue:Number, ratio:Number, end:Boolean):Number { if (!((tween.pluginData.ColorTransformEnabled == null && enabled) || tween.pluginData.ColorTransformEnabled)) { return value; } var ct:ColorTransform = tween.target.transform.colorTransform; if (name == "tint") { var aA:uint = initValue>>24&0xFF; var rA:uint = initValue>>16&0xFF; var gA:uint = initValue>>8&0xFF; var bA:uint = initValue&0xFF; var tint:uint = initValue+rangeValue>>0; var a:uint = aA+ratio*((tint>>24&0xFF)-aA); var r:uint = rA+ratio*((tint>>16&0xFF)-rA); var g:uint = gA+ratio*((tint>>8&0xFF)-gA); var b:uint = bA+ratio*((tint&0xFF)-bA); var mult:Number = 1-a/0xFF; tween.target.transform.colorTransform = new ColorTransform(mult,mult,mult,ct.alphaMultiplier,r,g,b,ct.alphaOffset); } else { ct[name] = value; tween.target.transform.colorTransform = ct; } // tell GTween not to use the default assignment behaviour: return NaN; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/plugins/CurrentFramePlugin.as: -------------------------------------------------------------------------------- 1 | /** * CurrentFramePlugin by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.plugins { import com.gskinner.motion.GTween; import com.gskinner.motion.plugins.IGTweenPlugin; /** * Plugin for GTween. Allows you to tween the currentFrame property of the target. * This lets you keep a timeline animation in synch with a tween, even when the duration * changes. *

* Supports the following pluginData properties:
    *
  • CurrentFrameEnabled: overrides the enabled property for the plugin on a per tween basis. *
**/ public class CurrentFramePlugin implements IGTweenPlugin { // Static interface: /** Specifies whether this plugin is enabled for all tweens by default. **/ public static var enabled:Boolean=true; /** @private **/ protected static var instance:CurrentFramePlugin; /** * Installs this plugin for use with all GTween instances. **/ public static function install():void { if (instance) { return; } instance = new CurrentFramePlugin(); GTween.installPlugin(instance,["currentFrame"]); } // Public methods: /** @private **/ public function init(tween:GTween, name:String, value:Number):Number { return value; } /** @private **/ public function tween(tween:GTween, name:String, value:Number, initValue:Number, rangeValue:Number, ratio:Number, end:Boolean):Number { if (!((tween.pluginData.CurrentFrameEnabled == null && enabled) || tween.pluginData.CurrentFrameEnabled)) { return value; } var frame:uint = Math.round(initValue+rangeValue*ratio); if (tween.target.currentFrame != frame) { tween.target.gotoAndStop(frame); } // tell GTween not to use the default assignment behaviour: return NaN; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/plugins/IGTweenPlugin.as: -------------------------------------------------------------------------------- 1 | package com.gskinner.motion.plugins { import com.gskinner.motion.GTween; /** * Defines the interface for GTween plugins. GTween does not use this interface * internally (for better portability of the class), but it is recommended that * plugin developers implement this interface in their plugins so that if changes * are made to the interface, compile time errors will be generated for plugins * that have not been updated. *

* Generally, plugins should also expose a static .install() method * which registers an instance of the plugin using GTween.registerPlugin(). * The easiest way to learn how to develop plugins is to look at the sample plugins. * SnappingPlugin and AutoHidePlugin provide simple examples, whereas ColorAdjustPlugin * provides a more advanced example. **/ public interface IGTweenPlugin { /** * This method will be called from the GTween init method when it is determining * the initial values for a property. A plugin's init method should return the * initial value of the specified property (often by just returning the value * parameter without modifying it) * or NaN to indicate that an initial value should not be set. * * @param tween The tween this plugin is being applied to. * @param name The name of the property being tweened. * @param value The current init value that will be applied to the specified property. **/ function init(tween:GTween, name:String, value:Number):Number; /** * This method will be called from a GTween instance when it is rendering a new * position value, and is tweening a property that this plugin is registered for. * The plugin can affect the target directly, or it can modify and return the value * parameter which will then be set on the target.

* GTween will call the tween method of each plugin registered for the property, * passing in the current calculated value for the property in the tween. Each plugin * has the opportunity to return a modified value property, which will then be passed * to subsequent plugins and ultimately set on the target, or it can return NaN to * indicate that the value should not be set on the target by GTween (ex. because it * has already been handled fully by the plugin).

* For example, a value snapping plugin could simply round the value parameter and * return it, whereas a blur plugin could work on the target's filters directly * and return NaN to prevent GTween from attempting to set a nonexistent blur * property on the target. * * @param tween The tween this plugin is being applied to. * @param name The name of the property being tweened. * @param value The current value that will be applied to the specified property of the target. This is normally equal to initValue+rangeValue*ratio, unless it has been modified by a prior plugin. * @param initValue The init value for the specified property. * @param rangeValue The range between the initValue and end value for the property. * @param ratio The current eased ratio of the tween. This is usually between 0-1. * @param end This will be true if the tween is at its end (ie. will call the complete event handler at the end of this tick). **/ function tween(tween:GTween, name:String, value:Number, initValue:Number, rangeValue:Number, ratio:Number, end:Boolean):Number; } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/plugins/MatrixPlugin.as: -------------------------------------------------------------------------------- 1 | /** * MatrixPlugin by Grant Skinner and Sebastian DeRossi. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.plugins { import com.gskinner.motion.GTween; import com.gskinner.motion.plugins.IGTweenPlugin; import flash.geom.Matrix; /** * Plugin for GTween. Tweens the a, b, c, d, tx, and ty properties of * the target's transform.matrix object. *

* Supports the following pluginData properties:
    *
  • MatrixEnabled: overrides the enabled property for the plugin on a per tween basis. *
**/ public class MatrixPlugin { // Static interface: /** Specifies whether this plugin is enabled for all tweens by default. **/ public static var enabled:Boolean=true; /** @private **/ protected static var instance:MatrixPlugin; /** @private **/ protected static var tweenProperties:Array = ['a', 'b', 'c', 'd', 'tx', 'ty']; /** * Installs this plugin for use with all GTween instances. **/ public static function install():void { if (instance) { return; } instance = new MatrixPlugin(); GTween.installPlugin(instance, tweenProperties, true); } // Public methods: /** @private **/ public function init(tween:GTween, name:String, value:Number):Number { if (!((enabled && tween.pluginData.MatrixEnabled == null) || tween.pluginData.MatrixEnabled)) { return value; } return tween.target.transform.matrix[name]; } /** @private **/ public function tween(tween:GTween, name:String, value:Number, initValue:Number, rangeValue:Number, ratio:Number, end:Boolean):Number { if (!((enabled && tween.pluginData.MatrixEnabled == null) || tween.pluginData.MatrixEnabled)) { return value; } var matrix:Matrix = tween.target.transform.matrix; matrix[name] = value; tween.target.transform.matrix = matrix; // tell GTween not to use the default assignment behaviour: return NaN; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/plugins/MotionBlurPlugin.as: -------------------------------------------------------------------------------- 1 | /** * MotionBlurPlugin by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.plugins { import com.gskinner.motion.GTween; import flash.filters.BlurFilter; import com.gskinner.motion.plugins.IGTweenPlugin; /** * Plugin for GTween. Automatically applies a motion blur effect when x & y are tweened. This plugin * will create a new blur filter on the target, and remove it based on a saved index when the tween ends. * This can potentially cause problems with other filters that create or remove filters. *

* Note: Because it works on the common x,y properties, and has a reasonably high CPU cost, * this plugin is disabled for all tweens by default (ie. its enabled property is set to false). * Set pluginData.MotionBlurEnabled to true on the tweens you want to enable it for, * or set MotionBlurPlugin.enabled to true to enable it by default for all tweens. *

* Supports the following pluginData properties:
    *
  • MotionBlurEnabled: overrides the enabled property for the plugin on a per tween basis. *
  • MotionBlurData: Used internally. *
**/ public class MotionBlurPlugin implements IGTweenPlugin { // Static interface: /** Specifies whether this plugin is enabled for all tweens by default. **/ public static var enabled:Boolean=false; /** Specifies the strength to use when calculating the blur. A higher value will result in more blurring. **/ public static var strength:Number = 0.6; /** @private **/ protected static var instance:MotionBlurPlugin; /** * Installs this plugin for use with all GTween instances. **/ public static function install():void { if (instance) { return; } instance = new MotionBlurPlugin(); GTween.installPlugin(instance,["x","y"]); } // Public methods: /** @private **/ public function init(tween:GTween, name:String, value:Number):Number { return value; } /** @private **/ public function tween(tween:GTween, name:String, value:Number, initValue:Number, rangeValue:Number, ratio:Number, end:Boolean):Number { if (!((enabled && tween.pluginData.MotionBlurEnabled == null) || tween.pluginData.MotionBlurEnabled)) { return value; } var data:Object = tween.pluginData.MotionBlurData; if (data == null) { data = initTarget(tween); } var f:Array = tween.target.filters; var blurF:BlurFilter = f[data.index] as BlurFilter; if (blurF == null) { return value; } if (end) { f.splice(data.index,1); delete(tween.pluginData.MotionBlurData); } else { var blur:Number = Math.abs((tween.ratioOld-ratio)*rangeValue*strength); if (name == "x") { blurF.blurX = blur; } else { blurF.blurY = blur; } } tween.target.filters = f; // tell GTween to tween x/y with the default value: return value; } // Private methods: /** @private **/ protected function initTarget(tween:GTween):Object { var f:Array = tween.target.filters; f.push(new BlurFilter(0,0,1)); tween.target.filters = f; return tween.pluginData.MotionBlurData = {index:f.length-1}; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/plugins/SmartRotationPlugin.as: -------------------------------------------------------------------------------- 1 | /** * SmartRotationPlugin by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.plugins { import com.gskinner.motion.GTween; import com.gskinner.motion.plugins.IGTweenPlugin; /** * Plugin for GTween. Makes rotation tweens rotate in the shortest direction. For example, rotating * from 5 to 330 degrees would rotate -35 degrees with smart rotation, instead of +325 degrees. *

* Supports the following pluginData properties:
    *
  • SmartRotationEnabled: overrides the enabled property for the plugin on a per tween basis. *
**/ public class SmartRotationPlugin implements IGTweenPlugin { // Static interface: /** Specifies whether this plugin is enabled for all tweens by default. **/ public static var enabled:Boolean=true; /** @private **/ protected static var instance:SmartRotationPlugin; /** @private **/ protected static var tweenProperties:Array = ["rotation","rotationX","rotationY","rotationZ"]; /** * Installs this plugin for use with all GTween instances. * * @param properties Specifies the properties to apply this plugin to. Defaults to rotation, rotationX, rotationY, and rotationZ. **/ public static function install(properties:Array=null):void { if (instance) { return; } instance = new SmartRotationPlugin(); GTween.installPlugin(instance, properties || tweenProperties, true); } // Public methods: /** @private **/ public function init(tween:GTween, name:String, value:Number):Number { return value; } /** @private **/ public function tween(tween:GTween, name:String, value:Number, initValue:Number, rangeValue:Number, ratio:Number, end:Boolean):Number { if (!((enabled && tween.pluginData.SmartRotationEnabled == null) || tween.pluginData.SmartRotationEnabled)) { return value; } rangeValue %= 360; if (rangeValue > 180) { rangeValue -= 360; } else if (rangeValue < -180) { rangeValue += 360; } return initValue+rangeValue*ratio; } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/plugins/SnappingPlugin.as: -------------------------------------------------------------------------------- 1 | /** * SnappingPlugin by Grant Skinner. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.plugins { import com.gskinner.motion.GTween; import com.gskinner.motion.plugins.IGTweenPlugin; /** * Plugin for GTween. Snaps (rounds) values to whole numbers during a tween. *

* Supports the following pluginData properties:
    *
  • SnappingEnabled: overrides the enabled property for the plugin on a per tween basis. *
**/ public class SnappingPlugin implements IGTweenPlugin { // Static interface: /** Specifies whether this plugin is enabled for all tweens by default. **/ public static var enabled:Boolean=true; /** @private **/ protected static var instance:SnappingPlugin; /** @private **/ protected static var tweenProperties:Array = ["x","y"]; /** * Installs this plugin for use with all GTween instances. * * @param properties Specifies the properties to apply this plugin to. Defaults to x and y. **/ public static function install(properties:Array=null):void { if (instance) { return; } instance = new SnappingPlugin(); GTween.installPlugin(instance, properties || tweenProperties, true); } // Public methods: /** @private **/ public function init(tween:GTween, name:String, value:Number):Number { return value; } /** @private **/ public function tween(tween:GTween, name:String, value:Number, initValue:Number, rangeValue:Number, ratio:Number, end:Boolean):Number { if (!((enabled && tween.pluginData.SnappingEnabled == null) || tween.pluginData.SnappingEnabled)) { return value; } return Math.round(value); } } } -------------------------------------------------------------------------------- /src/com/gskinner/motion/plugins/SoundTransformPlugin.as: -------------------------------------------------------------------------------- 1 | /** * SoundTransformPlugin by Grant Skinner and Sebastian DeRossi. Nov 3, 2009 * Visit www.gskinner.com/blog for documentation, updates and more free code. * * * Copyright (c) 2009 Grant Skinner * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. **/ package com.gskinner.motion.plugins { import com.gskinner.motion.GTween; import com.gskinner.motion.plugins.IGTweenPlugin; import flash.media.Sound; import flash.media.SoundChannel; import flash.media.SoundTransform; /** * Plugin for GTween. Tweens the volume, pan, leftToLeft, leftToRight, rightToLeft, and rightToRight * properties of the target's soundTransform object. *

* Supports the following pluginData properties:
    *
  • SoundTransformEnabled: overrides the enabled property for the plugin on a per tween basis. *
**/ public class SoundTransformPlugin implements IGTweenPlugin { // Static interface: /** Specifies whether this plugin is enabled for all tweens by default. **/ public static var enabled:Boolean=true; /** @private **/ protected static var instance:SoundTransformPlugin; /** @private **/ protected static var tweenProperties:Array = ["leftToLeft", "leftToRight", "pan", "rightToLeft", "rightToRight", "volume"]; /** * Installs this plugin for use with all GTween instances. **/ public static function install():void { if (instance) { return; } instance = new SoundTransformPlugin(); GTween.installPlugin(instance, tweenProperties, true); } // Public methods: /** @private **/ public function init(tween:GTween, name:String, value:Number):Number { if (!((enabled && tween.pluginData.SoundTransformEnabled == null) || tween.pluginData.SoundTransformEnabled)) { return value; } return tween.target.soundTransform[name]; } /** @private **/ public function tween(tween:GTween, name:String, value:Number, initValue:Number, rangeValue:Number, ratio:Number, end:Boolean):Number { if (!((enabled && tween.pluginData.SoundTransformEnabled == null) || tween.pluginData.SoundTransformEnabled)) { return value; } var soundTransform:SoundTransform = tween.target.soundTransform; soundTransform[name] = value; tween.target.soundTransform = soundTransform; // tell GTween not to use the default assignment behaviour: return NaN; } } } -------------------------------------------------------------------------------- /src/com/utils/Delay.as: -------------------------------------------------------------------------------- 1 | package com.utils 2 | { 3 | import flash.events.TimerEvent; 4 | import flash.utils.Timer; 5 | public class Delay 6 | { 7 | private var timer:Timer; 8 | private var delayedFunction:Function; 9 | public function Delay(functionToDelay:Function, delayMilisec:Number) 10 | { 11 | this.delayedFunction = functionToDelay; 12 | timer = new Timer(delayMilisec, 1); 13 | timer.addEventListener(TimerEvent.TIMER_COMPLETE, callDelayedFunction); 14 | timer.start(); 15 | } 16 | private function callDelayedFunction(event:TimerEvent):void 17 | { 18 | timer.removeEventListener(TimerEvent.TIMER_COMPLETE, callDelayedFunction); 19 | delayedFunction(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/de/flintfabrik/starling/display/FFParticleSystem/Frame.as: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // 3 | // Starling Framework - Particle System Extension 4 | // Copyright 2011 Gamua OG. All Rights Reserved. 5 | // 6 | // This program is free software. You can redistribute and/or modify it 7 | // in accordance with the terms of the accompanying license agreement. 8 | // 9 | // ================================================================================================= 10 | 11 | package de.flintfabrik.starling.display.FFParticleSystem 12 | { 13 | 14 | public class Frame 15 | { 16 | 17 | public var particleHalfWidth:Number = 1.0; 18 | public var particleHalfHeight:Number = 1.0; 19 | public var textureX:Number = 0.0; 20 | public var textureY:Number = 0.0; 21 | public var textureWidth:Number = 1.0; 22 | public var textureHeight:Number = 1.0; 23 | 24 | public function Frame(nativeTextureWidth:Number = 64, nativeTextureHeight:Number = 64, x:Number = 0.0, y:Number = 0.0, width:Number = 64.0, height:Number = 64.0) 25 | { 26 | textureX = x / nativeTextureWidth; 27 | textureY = y / nativeTextureHeight; 28 | textureWidth = (x + width) / nativeTextureWidth; 29 | textureHeight = (y + height) / nativeTextureHeight; 30 | particleHalfWidth = (width) >> 1; 31 | particleHalfHeight = (height) >> 1; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/de/flintfabrik/starling/display/FFParticleSystem/Particle.as: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // 3 | // Starling Framework - Particle System Extension 4 | // Copyright 2011 Gamua OG. All Rights Reserved. 5 | // 6 | // This program is free software. You can redistribute and/or modify it 7 | // in accordance with the terms of the accompanying license agreement. 8 | // 9 | // ================================================================================================= 10 | 11 | package de.flintfabrik.starling.display.FFParticleSystem 12 | { 13 | public class Particle 14 | { 15 | 16 | public var x:Number = 0.0; 17 | public var y:Number = 0.0; 18 | public var scale:Number = 1.0; 19 | public var rotation:Number = 0.0; 20 | public var alpha:Number = 1.0; 21 | public var currentTime:Number = 0; 22 | public var totalTime:Number = 1.0; 23 | 24 | public var colorRed:Number = 1.0; 25 | public var colorGreen:Number = 1.0; 26 | public var colorBlue:Number = 1.0; 27 | public var colorAlpha:Number = 1.0; 28 | 29 | public var colorDeltaRed:Number = 0.0; 30 | public var colorDeltaGreen:Number = 0.0; 31 | public var colorDeltaBlue:Number = 0.0; 32 | public var colorDeltaAlpha:Number = 0.0; 33 | 34 | public var startX:Number = 0.0; 35 | public var startY:Number = 0.0; 36 | public var velocityX:Number = 0.0; 37 | public var velocityY:Number = 0.0; 38 | public var radialAcceleration:Number = 0.0; 39 | public var tangentialAcceleration:Number = 0.0; 40 | public var emitRadius:Number = 1.0; 41 | public var emitRadiusDelta:Number = 0.0; 42 | public var emitRotation:Number = 0.0; 43 | public var emitRotationDelta:Number = 0.0; 44 | public var rotationDelta:Number = 0.0; 45 | public var scaleDelta:Number = 0.0; 46 | public var frameIdx:int = 0; 47 | public var frame:Number = 0; 48 | public var frameDelta:Number = 0; 49 | 50 | public var fadeInFactor:Number = 0; 51 | public var fadeOutFactor:Number = 0; 52 | public var spawnFactor:Number = 0; 53 | 54 | public var active:Boolean = false; 55 | 56 | public var customValues:Object; 57 | 58 | public function Particle() { } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/de/flintfabrik/starling/utils/ColorArgb.as: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // 3 | // Starling Framework - Particle System Extension 4 | // Copyright 2011 Gamua OG. All Rights Reserved. 5 | // 6 | // This program is free software. You can redistribute and/or modify it 7 | // in accordance with the terms of the accompanying license agreement. 8 | // 9 | // ================================================================================================= 10 | 11 | package de.flintfabrik.starling.utils 12 | { 13 | public class ColorArgb 14 | { 15 | public var red:Number; 16 | public var green:Number; 17 | public var blue:Number; 18 | public var alpha:Number; 19 | 20 | public static function fromRgb(color:uint):ColorArgb 21 | { 22 | var rgb:ColorArgb = new ColorArgb(); 23 | rgb.fromRgb(color); 24 | return rgb; 25 | } 26 | 27 | public static function fromArgb(color:uint):ColorArgb 28 | { 29 | var argb:ColorArgb = new ColorArgb(); 30 | argb.fromArgb(color); 31 | return argb; 32 | } 33 | 34 | public function ColorArgb(red:Number=0, green:Number=0, blue:Number=0, alpha:Number=0) 35 | { 36 | this.red = red; 37 | this.green = green; 38 | this.blue = blue; 39 | this.alpha = alpha; 40 | } 41 | 42 | public function toRgb():uint 43 | { 44 | var r:Number = red; if (r < 0.0) r = 0.0; else if (r > 1.0) r = 1.0; 45 | var g:Number = green; if (g < 0.0) g = 0.0; else if (g > 1.0) g = 1.0; 46 | var b:Number = blue; if (b < 0.0) b = 0.0; else if (b > 1.0) b = 1.0; 47 | 48 | return int(r * 255) << 16 | int(g * 255) << 8 | int(b * 255); 49 | } 50 | 51 | public function toArgb():uint 52 | { 53 | var a:Number = alpha; if (a < 0.0) a = 0.0; else if (a > 1.0) a = 1.0; 54 | var r:Number = red; if (r < 0.0) r = 0.0; else if (r > 1.0) r = 1.0; 55 | var g:Number = green; if (g < 0.0) g = 0.0; else if (g > 1.0) g = 1.0; 56 | var b:Number = blue; if (b < 0.0) b = 0.0; else if (b > 1.0) b = 1.0; 57 | 58 | return int(a * 255) << 24 | int(r * 255) << 16 | int(g * 255) << 8 | int(b * 255); 59 | } 60 | 61 | public function fromRgb(color:uint):void 62 | { 63 | red = (color >> 16 & 0xFF) / 255.0; 64 | green = (color >> 8 & 0xFF) / 255.0; 65 | blue = (color & 0xFF) / 255.0; 66 | } 67 | 68 | public function fromArgb(color:uint):void 69 | { 70 | red = (color >> 16 & 0xFF) / 255.0; 71 | green = (color >> 8 & 0xFF) / 255.0; 72 | blue = (color & 0xFF) / 255.0; 73 | alpha = (color >> 24 & 0xFF) / 255.0; 74 | } 75 | 76 | public function copyFrom(argb:ColorArgb):void 77 | { 78 | red = argb.red; 79 | green = argb.green; 80 | blue = argb.blue; 81 | alpha = argb.alpha; 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/starling/extensions/ColorArgb.as: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // 3 | // Starling Framework - Particle System Extension 4 | // Copyright 2011 Gamua OG. All Rights Reserved. 5 | // 6 | // This program is free software. You can redistribute and/or modify it 7 | // in accordance with the terms of the accompanying license agreement. 8 | // 9 | // ================================================================================================= 10 | 11 | package starling.extensions 12 | { 13 | public class ColorArgb 14 | { 15 | public var red:Number; 16 | public var green:Number; 17 | public var blue:Number; 18 | public var alpha:Number; 19 | 20 | public static function fromRgb(color:uint):ColorArgb 21 | { 22 | var rgb:ColorArgb = new ColorArgb(); 23 | rgb.fromRgb(color); 24 | return rgb; 25 | } 26 | 27 | public static function fromArgb(color:uint):ColorArgb 28 | { 29 | var argb:ColorArgb = new ColorArgb(); 30 | argb.fromArgb(color); 31 | return argb; 32 | } 33 | 34 | public function ColorArgb(red:Number=0, green:Number=0, blue:Number=0, alpha:Number=0) 35 | { 36 | this.red = red; 37 | this.green = green; 38 | this.blue = blue; 39 | this.alpha = alpha; 40 | } 41 | 42 | public function toRgb():uint 43 | { 44 | var r:Number = red; if (r < 0.0) r = 0.0; else if (r > 1.0) r = 1.0; 45 | var g:Number = green; if (g < 0.0) g = 0.0; else if (g > 1.0) g = 1.0; 46 | var b:Number = blue; if (b < 0.0) b = 0.0; else if (b > 1.0) b = 1.0; 47 | 48 | return int(r * 255) << 16 | int(g * 255) << 8 | int(b * 255); 49 | } 50 | 51 | public function toArgb():uint 52 | { 53 | var a:Number = alpha; if (a < 0.0) a = 0.0; else if (a > 1.0) a = 1.0; 54 | var r:Number = red; if (r < 0.0) r = 0.0; else if (r > 1.0) r = 1.0; 55 | var g:Number = green; if (g < 0.0) g = 0.0; else if (g > 1.0) g = 1.0; 56 | var b:Number = blue; if (b < 0.0) b = 0.0; else if (b > 1.0) b = 1.0; 57 | 58 | return int(a * 255) << 24 | int(r * 255) << 16 | int(g * 255) << 8 | int(b * 255); 59 | } 60 | 61 | public function fromRgb(color:uint):void 62 | { 63 | red = (color >> 16 & 0xFF) / 255.0; 64 | green = (color >> 8 & 0xFF) / 255.0; 65 | blue = (color & 0xFF) / 255.0; 66 | } 67 | 68 | public function fromArgb(color:uint):void 69 | { 70 | red = (color >> 16 & 0xFF) / 255.0; 71 | green = (color >> 8 & 0xFF) / 255.0; 72 | blue = (color & 0xFF) / 255.0; 73 | alpha = (color >> 24 & 0xFF) / 255.0; 74 | } 75 | 76 | public function copyFrom(argb:ColorArgb):void 77 | { 78 | red = argb.red; 79 | green = argb.green; 80 | blue = argb.blue; 81 | alpha = argb.alpha; 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /src/starling/extensions/PDParticle.as: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // 3 | // Starling Framework - Particle System Extension 4 | // Copyright 2012 Gamua OG. All Rights Reserved. 5 | // 6 | // This program is free software. You can redistribute and/or modify it 7 | // in accordance with the terms of the accompanying license agreement. 8 | // 9 | // ================================================================================================= 10 | 11 | package starling.extensions 12 | { 13 | public class PDParticle extends Particle 14 | { 15 | public var colorArgb:ColorArgb; 16 | public var colorArgbDelta:ColorArgb; 17 | public var startX:Number, startY:Number; 18 | public var velocityX:Number, velocityY:Number; 19 | public var radialAcceleration:Number; 20 | public var tangentialAcceleration:Number; 21 | public var emitRadius:Number, emitRadiusDelta:Number; 22 | public var emitRotation:Number, emitRotationDelta:Number; 23 | public var rotationDelta:Number; 24 | public var scaleDelta:Number; 25 | 26 | public function PDParticle() 27 | { 28 | colorArgb = new ColorArgb(); 29 | colorArgbDelta = new ColorArgb(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/starling/extensions/Particle.as: -------------------------------------------------------------------------------- 1 | // ================================================================================================= 2 | // 3 | // Starling Framework - Particle System Extension 4 | // Copyright 2011 Gamua OG. All Rights Reserved. 5 | // 6 | // This program is free software. You can redistribute and/or modify it 7 | // in accordance with the terms of the accompanying license agreement. 8 | // 9 | // ================================================================================================= 10 | 11 | package starling.extensions 12 | { 13 | public class Particle 14 | { 15 | public var x:Number; 16 | public var y:Number; 17 | public var scale:Number; 18 | public var rotation:Number; 19 | public var color:uint; 20 | public var alpha:Number; 21 | public var currentTime:Number; 22 | public var totalTime:Number; 23 | 24 | public function Particle() 25 | { 26 | x = y = rotation = currentTime = 0.0; 27 | totalTime = alpha = scale = 1.0; 28 | color = 0xffffff; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/starling/filters/BaseFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import starling.textures.Texture; 26 | 27 | import flash.display3D.Context3D; 28 | import flash.display3D.Program3D; 29 | 30 | /** 31 | * Base Filter class for FragmentFilters in OneByOneDesign Starling Filters Package. 32 | * Do not instantiate directly. 33 | */ 34 | public class BaseFilter extends FragmentFilter 35 | { 36 | // Shaders 37 | 38 | protected var FRAGMENT_SHADER:String; 39 | protected var VERTEX_SHADER:String; 40 | 41 | /** Program 3D */ 42 | protected var program:Program3D 43 | 44 | /** @private */ 45 | public function BaseFilter() 46 | { 47 | super(1, 1.0); 48 | } 49 | 50 | /** Dispose */ 51 | override public function dispose():void 52 | { 53 | if (this.program != null) 54 | this.program.dispose(); 55 | 56 | super.dispose(); 57 | } 58 | 59 | /** Create Programs */ 60 | override protected function createPrograms():void 61 | { 62 | setAgal(); 63 | this.program = assembleAgal(FRAGMENT_SHADER, VERTEX_SHADER); 64 | } 65 | 66 | /** Set AGAL */ 67 | protected function setAgal():void 68 | { 69 | // Override this to assign values to FRAGMENT_SHADER and VERTEX_SHADER 70 | } 71 | 72 | /** Activate */ 73 | override protected function activate(pass:int, context:Context3D, texture:Texture):void 74 | { 75 | context.setProgram(this.program); 76 | } 77 | } 78 | 79 | 80 | } -------------------------------------------------------------------------------- /src/starling/filters/BleachFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DProgramType; 27 | import starling.textures.Texture; 28 | 29 | /** 30 | * Produces a "bleached out" effect 31 | * @author Devon O. 32 | */ 33 | public class BleachFilter extends BaseFilter 34 | { 35 | private var fc0:Vector. = new [0.2125, 0.7154, 0.0721, 0.0]; 36 | private var fc1:Vector. = new [2.0, 2.0, 2.0, 2.0]; 37 | private var fc2:Vector. = new [1.0, 1.0, 1.0, 1.0]; 38 | private var _vars:Vector. = new [.45, 10.0, 1, 0]; 39 | 40 | private var _amount:Number; 41 | 42 | /** 43 | * Create a new Bleach Filter 44 | * @param amount Amount of bleach to apply (between 0 and 2 is good) 45 | */ 46 | public function BleachFilter(amount:Number=1.0) 47 | { 48 | _amount = amount; 49 | } 50 | 51 | /** Set AGAL */ 52 | override protected function setAgal():void 53 | { 54 | FRAGMENT_SHADER = 55 | 58 | dp4 ft1.x, ft0, fc0 59 | mov ft2.xyzw, ft1.xxxx 60 | 61 | // amount of mix 62 | sub ft1.x, ft1.x, fc3.x 63 | mul ft1.x, ft1.x, fc3.y 64 | sat ft1.x, ft1.x 65 | mov ft1.yzw, ft1.xxx 66 | 67 | mul ft3, ft0, fc1 68 | mul ft3, ft3, ft2 69 | 70 | sub ft4, fc2, ft0 71 | sub ft5, fc2, ft2 72 | mul ft4, ft4, ft5 73 | mul ft4, ft4, fc1 74 | sub ft4, fc2, ft4 75 | 76 | sub ft4, ft4, ft3 77 | mul ft4, ft4, ft1 78 | add ft4, ft4, ft3 79 | 80 | // mix(original, result, amount); 81 | sub ft4, ft4, ft0 82 | mul ft4, ft4, fc3.zzzz 83 | add oc, ft4, ft0 84 | 85 | ]]> 86 | } 87 | 88 | /** Activate */ 89 | protected override function activate(pass:int, context:Context3D, texture:Texture):void 90 | { 91 | _vars[2] = _amount; 92 | 93 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, fc0, 1); 94 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 1, fc1, 1); 95 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 2, fc2, 1); 96 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 3, _vars, 1); 97 | 98 | super.activate(pass, context, texture); 99 | } 100 | 101 | /** Amount of bleach (between 0 and 2 is generally good) */ 102 | public function get amount():Number { return _amount; } 103 | public function set amount(value:Number):void { _amount = value; } 104 | } 105 | } -------------------------------------------------------------------------------- /src/starling/filters/ChromakeyFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DBlendFactor; 27 | import flash.display3D.Context3DProgramType; 28 | import starling.textures.Texture; 29 | 30 | /** 31 | * The ChromakeyFilter will 'key out' a specified color (setting its alpha to 0) 32 | * @author Devon O. 33 | */ 34 | 35 | public class ChromakeyFilter extends BaseFilter 36 | { 37 | private var _vars:Vector. = new [1, 1, 1, 1]; 38 | 39 | private var _color:ColorObject; 40 | private var _threshold:Number; 41 | 42 | /** 43 | * @param color The color to remove 44 | * @param threshold The threshold test for the keyed color 45 | */ 46 | public function ChromakeyFilter(color:uint=0x00FF00, threshold:Number=.25) 47 | { 48 | _color = new ColorObject(color); 49 | _threshold = threshold; 50 | } 51 | 52 | /** Set AGAL */ 53 | override protected function setAgal():void 54 | { 55 | FRAGMENT_SHADER = 56 | 58 | sub ft2.x, ft0.x, fc0.x 59 | mul ft2.x, ft2.x, ft2.x 60 | sub ft2.y, ft0.y, fc0.y 61 | mul ft2.y, ft2.y, ft2.y 62 | sub ft2.z, ft0.z, fc0.z 63 | mul ft2.z, ft2.z, ft2.z 64 | add ft2.w, ft2.x, ft2.y 65 | add ft2.w, ft2.w, ft2.z 66 | sqt ft1.x, ft2.w 67 | sge ft0.w, ft1.x, fc0.w 68 | mov oc, ft0 69 | ]]> 70 | } 71 | 72 | /** Activate */ 73 | protected override function activate(pass:int, context:Context3D, texture:Texture):void 74 | { 75 | _vars[0] = _color.r; 76 | _vars[1] = _color.g; 77 | _vars[2] = _color.b; 78 | _vars[3] = _threshold; 79 | 80 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, _vars, 1); 81 | context.setBlendFactors(Context3DBlendFactor.SOURCE_ALPHA, Context3DBlendFactor.ONE_MINUS_SOURCE_ALPHA); 82 | 83 | super.activate(pass, context, texture); 84 | } 85 | 86 | /** Deactivate */ 87 | override protected function deactivate(pass:int, context:Context3D, texture:Texture):void 88 | { 89 | context.setBlendFactors(Context3DBlendFactor.ONE, Context3DBlendFactor.ZERO); 90 | } 91 | 92 | /** Color */ 93 | public function set color(value:uint):void { _color.setColor(value); } 94 | public function get color():uint { return _color.getColor(); } 95 | 96 | /** Threshold */ 97 | public function set threshold(value:Number):void { _threshold = value; } 98 | public function get threshold():Number { return _threshold; } 99 | } 100 | } 101 | 102 | class ColorObject 103 | { 104 | public var r:Number; 105 | public var g:Number; 106 | public var b:Number; 107 | 108 | public function ColorObject(color:uint) 109 | { 110 | setColor(color); 111 | } 112 | 113 | public function setColor(color:uint):void 114 | { 115 | var red:uint = color >> 16; 116 | var green:uint = color >> 8 & 0xFF; 117 | var blue:uint = color & 0xFF; 118 | 119 | r = red / 0xFF; 120 | g = green / 0xFF; 121 | b = blue / 0xFF; 122 | } 123 | 124 | public function getColor():uint 125 | { 126 | var red:uint = r * 0xFF; 127 | var green:uint = g * 0xFF; 128 | var blue:uint = b * 0xFF; 129 | return red << 16 | green << 8 | blue; 130 | } 131 | } -------------------------------------------------------------------------------- /src/starling/filters/CrossProcessingFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DBlendFactor; 27 | import flash.display3D.Context3DProgramType; 28 | import starling.textures.Texture; 29 | 30 | /** 31 | * Cross Processing effect 32 | * @author Devon O. 33 | */ 34 | public class CrossProcessingFilter extends BaseFilter 35 | { 36 | [Embed(source="assets/cross-processing.jpg")] 37 | private static const SAMPLE_SOURCE:Class; 38 | 39 | private var sample:Texture; 40 | private var vars:Vector. = new [1, .50, 0, .0]; 41 | 42 | private var _amount:Number; 43 | 44 | /** Create a new CrossProcessingFilter */ 45 | public function CrossProcessingFilter() 46 | { 47 | this.sample = Texture.fromBitmap(new SAMPLE_SOURCE(), false); 48 | } 49 | 50 | /** Dispose */ 51 | override public function dispose():void 52 | { 53 | this.sample.dispose(); 54 | super.dispose(); 55 | } 56 | 57 | /** Set AGAL */ 58 | override protected function setAgal():void 59 | { 60 | FRAGMENT_SHADER = 61 | 64 | 65 | mov ft1.y, fc0.y 66 | 67 | // r 68 | mov ft1.x, ft0.x 69 | tex ft2, ft1.xy, fs1<2d, clamp, linear, mipnone> 70 | mov ft3.x, ft2.x 71 | 72 | // g 73 | mov ft1.x, ft0.y 74 | tex ft2, ft1.xy, fs1<2d, clamp, linear, mipnone> 75 | mov ft3.y, ft2.y 76 | 77 | // g 78 | mov ft1.x, ft0.z 79 | tex ft2, ft1.xy, fs1<2d, clamp, linear, mipnone> 80 | mov ft3.z, ft2.z 81 | 82 | // ft2 = mix (ft0, ft3, fc0.x) 83 | sub ft2.xyz, ft3.xyz, ft0.xyz 84 | mul ft2.xyz, ft2.xyz, fc0.x 85 | add ft2.xyz, ft2.xyz, ft0.xyz 86 | 87 | mov ft0.xyz, ft2.xyz 88 | 89 | mov oc, ft0 90 | ]]> 91 | } 92 | 93 | /** Activate */ 94 | override protected function activate(pass:int, context:Context3D, texture:Texture):void 95 | { 96 | this.vars[0] = this._amount; 97 | 98 | context.setTextureAt(1, this.sample.base); 99 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, this.vars, 1); 100 | context.setBlendFactors(Context3DBlendFactor.SOURCE_ALPHA, Context3DBlendFactor.ONE_MINUS_SOURCE_ALPHA); 101 | 102 | super.activate(pass, context, texture); 103 | } 104 | 105 | /** Deactivate */ 106 | override protected function deactivate(pass:int, context:Context3D, texture:Texture):void 107 | { 108 | context.setTextureAt(1, null); 109 | context.setBlendFactors(Context3DBlendFactor.ONE, Context3DBlendFactor.ZERO); 110 | } 111 | 112 | /** Amount */ 113 | public function set amount(value:Number):void { this._amount = value; } 114 | public function get amount():Number { return this._amount; } 115 | } 116 | 117 | } -------------------------------------------------------------------------------- /src/starling/filters/GlassFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2013 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DProgramType; 27 | import starling.textures.Texture; 28 | 29 | /** 30 | * Creates a tiled glass distortion effect 31 | * @author Devon O. 32 | */ 33 | 34 | public class GlassFilter extends BaseFilter 35 | { 36 | private var vars:Vector. = new [1, 1, 1, 1]; 37 | 38 | private var _amount:Number; 39 | private var _ripple:Number; 40 | 41 | /** 42 | * Create a new GlassFilter effect 43 | * @param amount Amount of effect (0 - 1) 44 | * @param ripple Amount of ripple to apply 45 | */ 46 | public function GlassFilter(amount:Number=0.0, ripple:Number=0.0) 47 | { 48 | _amount = amount; 49 | _ripple = ripple; 50 | } 51 | 52 | /** Set AGAL */ 53 | override protected function setAgal():void 54 | { 55 | FRAGMENT_SHADER = 56 | 63 | ]]> 64 | } 65 | 66 | /** Activate */ 67 | protected override function activate(pass:int, context:Context3D, texture:Texture):void 68 | { 69 | this.vars[0] = _amount / 100; 70 | this.vars[1] = _ripple ; 71 | 72 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, this.vars, 1); 73 | 74 | super.activate(pass, context, texture); 75 | } 76 | 77 | /** Ripple */ 78 | public function get ripple():Number { return _ripple; } 79 | public function set ripple(value:Number):void { _ripple = value; } 80 | 81 | /** Amount (0 - 1) */ 82 | public function get amount():Number { return _amount; } 83 | public function set amount(value:Number):void { _amount = value; } 84 | } 85 | } -------------------------------------------------------------------------------- /src/starling/filters/MotionBlurFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2013 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DProgramType; 27 | import starling.textures.Texture; 28 | 29 | /** 30 | * Motion Blur filter for Starling Framework. 31 | * Only use with Context3DProfile.BASELINE (not compatible with constrained profile). 32 | * @author Devon O. 33 | */ 34 | 35 | public class MotionBlurFilter extends BaseFilter 36 | { 37 | private var vars:Vector. = new [1, 1, 1, 1]; 38 | 39 | private var steps:int; 40 | 41 | private var _amount:Number; 42 | private var _angle:Number; 43 | 44 | /** 45 | * Creates a new MotionBlurFilter 46 | * @param angle angle of blur in radians 47 | * @param amount the amount of blur 48 | * @param steps the level of the blur. A higher number produces a better result, but with worse performance. Can only be set once. 49 | */ 50 | public function MotionBlurFilter(angle:Number=0.0, amount:Number=1.0, steps:int=5, numPasses:int=1) 51 | { 52 | this._angle = angle; 53 | this._amount = clamp(amount, 0.0, 20.0); 54 | 55 | this.steps = int(clamp(steps, 1.0, 30.0)); 56 | 57 | this.numPasses = numPasses; 58 | 59 | marginX = marginY = _amount * this.steps; 60 | } 61 | 62 | /** Set AGAL */ 63 | protected override function setAgal():void 64 | { 65 | var step:String = 66 | "add ft0.xy, ft0.xy, fc0.xy \n"+ 67 | "tex ft2, ft0.xy, fs0<2d, clamp, linear, nomip> \n" + 68 | "add ft1, ft1, ft2 \n" 69 | 70 | var fragmentProgramCode:String = 71 | "mov ft0.xy, v0.xy \n" + 72 | "tex ft1, ft0.xy, fs0<2d, clamp, linear, nomip> \n" 73 | 74 | var numSteps:int = this.steps - 1; 75 | for (var i:int = 0; i < numSteps; i++) 76 | { 77 | fragmentProgramCode += step; 78 | } 79 | 80 | fragmentProgramCode += "div oc, ft1, fc0.zzz"; 81 | 82 | FRAGMENT_SHADER = fragmentProgramCode; 83 | } 84 | 85 | /** Activate */ 86 | protected override function activate(pass:int, context:Context3D, texture:Texture):void 87 | { 88 | var tSize:Number = (texture.width + texture.height) * .50; 89 | this.vars[0] = this._amount * Math.cos(this._angle) / tSize; 90 | this.vars[1] = this._amount * Math.sin(this._angle) / tSize; 91 | this.vars[2] = this.steps; 92 | 93 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, this.vars, 1); 94 | 95 | super.activate(pass, context, texture); 96 | } 97 | 98 | /** Clamp target between min and max */ 99 | private function clamp(target:Number, min:Number, max:Number):Number 100 | { 101 | if (target < min) target = min; 102 | if (target > max) target = max; 103 | return target; 104 | } 105 | 106 | /** Angle */ 107 | public function get angle():Number { return _angle; } 108 | public function set angle(value:Number):void { _angle = value; } 109 | 110 | /** Amount */ 111 | public function get amount():Number { return _amount; } 112 | public function set amount(value:Number):void 113 | { 114 | _amount = clamp(value, 0, 20); 115 | marginX = marginY = _amount * this.steps ; 116 | } 117 | } 118 | } -------------------------------------------------------------------------------- /src/starling/filters/NoiseFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DProgramType; 27 | import starling.textures.Texture; 28 | 29 | /** 30 | * Produces a noise/film grain effect on Starling display objects. 31 | * @author Devon O. 32 | */ 33 | public class NoiseFilter extends BaseFilter 34 | { 35 | 36 | private var noiseVars:Vector. = new [1, 1, 1, 0]; 37 | private var randVars:Vector. = new [12.9898, 78.233, 43758.5453, Math.PI]; 38 | 39 | private var _seedX:Number; 40 | private var _seedY:Number; 41 | private var _amount:Number; 42 | 43 | /** 44 | * Create a new Noise Filter 45 | * @param amount Amount of noise (between 0 and 2.0 is good) 46 | */ 47 | public function NoiseFilter(amount:Number=.25) 48 | { 49 | _amount = amount; 50 | _seedX = Math.random(); 51 | _seedY = Math.random(); 52 | } 53 | 54 | /** Set AGAL*/ 55 | protected override function setAgal():void 56 | { 57 | FRAGMENT_SHADER = 58 | 60 | 61 | mov ft1.xy, v0.xy 62 | add ft1.xy, ft1.xy, fc0.xy 63 | mov ft6.xy, fc1.xy 64 | 65 | // 'improved' "canonical one-liner" noise function 66 | //@see http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ 67 | dp3 ft1.x, ft1.xy, ft6.xy 68 | div ft1.x, ft1.x, fc1.w 69 | frc ft1.x, ft1.x 70 | mul ft1.x, ft1.x, fc1.w 71 | sin ft1.x, ft1.x 72 | mul ft1.x, ft1.x, fc1.z 73 | frc ft1.x, ft1.x 74 | 75 | // multiply by amount 76 | mul ft1.x, ft1.x, fc0.z 77 | 78 | sub ft0.xyz, ft0.xyz, ft1.xxx 79 | mov oc, ft0 80 | ]]>; 81 | } 82 | 83 | /** Activate */ 84 | protected override function activate(pass:int, context:Context3D, texture:Texture):void 85 | { 86 | noiseVars[0] = _seedX; 87 | noiseVars[1] = _seedY; 88 | noiseVars[2] = _amount; 89 | 90 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, noiseVars, 1); 91 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 1, randVars, 1); 92 | 93 | super.activate(pass, context, texture); 94 | } 95 | 96 | /** Random seed in x dimension (between 0 and 1) */ 97 | public function get seedX():Number { return _seedX; } 98 | public function set seedX(value:Number):void { _seedX = value; } 99 | 100 | /** Random seed in y dimension (between 0 and 1) */ 101 | public function get seedY():Number { return _seedY; } 102 | public function set seedY(value:Number):void { _seedY = value; } 103 | 104 | /** Amount of noise (between 0 and 2 is best) */ 105 | public function get amount():Number { return _amount; } 106 | public function set amount(value:Number):void { _amount = value; } 107 | } 108 | } -------------------------------------------------------------------------------- /src/starling/filters/PixelateFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DProgramType; 27 | import starling.textures.Texture; 28 | 29 | /** 30 | * Pixelates images (square 'pixels') 31 | * @author Devon O. 32 | */ 33 | public class PixelateFilter extends BaseFilter 34 | { 35 | 36 | private var vars:Vector. = new [1, 1, 1, 1]; 37 | private var _size:int; 38 | 39 | /** 40 | * Creates a new PixelateFilter 41 | * @param size size of pixel effect 42 | */ 43 | public function PixelateFilter(size:int=8) 44 | { 45 | this._size = size; 46 | } 47 | 48 | /** Set AGAL */ 49 | protected override function setAgal():void 50 | { 51 | FRAGMENT_SHADER = 52 | 58 | ]]> 59 | } 60 | 61 | /** Activate */ 62 | protected override function activate(pass:int, context:Context3D, texture:Texture):void 63 | { 64 | this.vars[0] = this._size / texture.width; 65 | this.vars[1] = this._size / texture.height; 66 | 67 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, this.vars, 1); 68 | super.activate(pass, context, texture); 69 | } 70 | 71 | /** Pixel Size */ 72 | public function get pixelSize():int { return _size; } 73 | public function set pixelSize(value:int):void { _size = value; } 74 | } 75 | } -------------------------------------------------------------------------------- /src/starling/filters/PosterizeFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2013 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DProgramType; 27 | import starling.textures.Texture; 28 | 29 | /** 30 | * Creates a posterization/quantization effect 31 | * @author Devon O. 32 | */ 33 | 34 | public class PosterizeFilter extends BaseFilter 35 | { 36 | private var vars:Vector. = new [1, 1, 1, 1]; 37 | 38 | private var _numColors:int; 39 | private var _gamma:Number; 40 | 41 | /** 42 | * 43 | * @param numColors 44 | * @param gamma 45 | */ 46 | public function PosterizeFilter(numColors:int=8, gamma:Number=.60) 47 | { 48 | this._numColors = numColors; 49 | this._gamma = gamma; 50 | } 51 | 52 | /** Set AGAL */ 53 | protected override function setAgal():void 54 | { 55 | FRAGMENT_SHADER = 56 | 58 | pow ft0.xyz, ft0.xyz, fc0.yyy 59 | mul ft0.xyz, ft0.xyz, fc0.xxx 60 | frc ft1.xyz, ft0.xyz 61 | sub ft1.xyz, ft0.xyz, ft1.xyz 62 | div ft0.xyz, ft1.xyz, fc0.xxx 63 | pow ft0.xyz, ft0.xyz, fc0.zzz 64 | mov oc, ft0 65 | ]]> 66 | } 67 | 68 | /** Activate */ 69 | protected override function activate(pass:int, context:Context3D, texture:Texture):void 70 | { 71 | this.vars[0] = this._numColors; 72 | this.vars[1] = this._gamma; 73 | this.vars[2] = 1 / this._gamma; 74 | 75 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, this.vars, 1); 76 | super.activate(pass, context, texture); 77 | } 78 | 79 | /** Number of Colors */ 80 | public function get numColors():int { return _numColors; } 81 | public function set numColors(value:int):void { _numColors = value; } 82 | 83 | /** Gamma */ 84 | public function get gamma():Number { return _gamma; } 85 | public function set gamma(value:Number):void { _gamma = value; } 86 | } 87 | } -------------------------------------------------------------------------------- /src/starling/filters/ScanlineFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2013 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DProgramType; 27 | import starling.textures.Texture; 28 | 29 | /** 30 | * Creates scanlines in filtered display object 31 | * @author Devon O. 32 | */ 33 | 34 | public class ScanlineFilter extends BaseFilter 35 | { 36 | private var vars:Vector. = new [1, 1, 1, 1]; 37 | 38 | private var _spacing:Number; 39 | 40 | /** 41 | * Creates a new ScanlineFilter 42 | * @param spacing spacing between scanlines 43 | */ 44 | public function ScanlineFilter(spacing:Number=2.0) 45 | { 46 | this._spacing = spacing; 47 | } 48 | 49 | /** Set AGAL */ 50 | protected override function setAgal():void 51 | { 52 | FRAGMENT_SHADER = 53 | 62 | 63 | // scanline effect 64 | sub ft2.xyz, fc0.www, ft1.xyz 65 | mul ft2.xyz, ft2.xyz, ft0.xxx 66 | add ft2.xyz, ft2.xyz, ft1.xyz 67 | mul ft1.xyz, ft1.xyz, ft2.xyz 68 | 69 | mov oc, ft1 70 | ]]> 71 | } 72 | 73 | /** Activate */ 74 | protected override function activate(pass:int, context:Context3D, texture:Texture):void 75 | { 76 | this.vars[0] = this._spacing / texture.height 77 | 78 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, this.vars, 1); 79 | super.activate(pass, context, texture); 80 | } 81 | 82 | /** Spacing */ 83 | public function get spacing():Number { return _spacing; } 84 | public function set spacing(value:Number):void { _spacing = value; } 85 | 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/starling/filters/SineFilter.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2013 Devon O. Wolfgang 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package starling.filters 24 | { 25 | import flash.display3D.Context3D; 26 | import flash.display3D.Context3DProgramType; 27 | import starling.textures.Texture; 28 | 29 | /** 30 | * Creates a sine wave effect in horizontal or vertical direction. Use the ticker value to animate. 31 | * @author Devon O. 32 | */ 33 | 34 | public class SineFilter extends BaseFilter 35 | { 36 | private var vars:Vector. = new [1, 1, 1, 1]; 37 | private var booleans:Vector. = new [1, 1, 1, 1]; 38 | 39 | private var _amplitude:Number 40 | private var _ticker:Number; 41 | private var _frequency:Number; 42 | private var _isHorizontal:Boolean=true; 43 | 44 | /** 45 | * Creates a new SineFilter 46 | * @param amplitude wave amplitude 47 | * @param frequency wave frequency 48 | * @param ticker position of effect (use to animate) 49 | */ 50 | public function SineFilter(amplitude:Number=0.0, frequency:Number=0.0, ticker:Number=0.0) 51 | { 52 | this._amplitude = amplitude; 53 | this._ticker = ticker; 54 | this._frequency = frequency; 55 | } 56 | 57 | /** Set AGAL */ 58 | override protected function setAgal():void 59 | { 60 | FRAGMENT_SHADER = 61 | 77 | ]]> 78 | } 79 | 80 | /** Activate */ 81 | protected override function activate(pass:int, context:Context3D, texture:Texture):void 82 | { 83 | this.vars[1] = this._amplitude / texture.height; 84 | this.vars[2] = this._ticker; 85 | this.vars[3] = this._frequency ; 86 | 87 | this.booleans[0] = int(this._isHorizontal); 88 | this.booleans[1] = int(!this._isHorizontal); 89 | 90 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, this.vars, 1); 91 | context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 1, this.booleans, 1); 92 | 93 | super.activate(pass, context, texture); 94 | } 95 | 96 | /** Amplitude */ 97 | public function get amplitude():Number { return this._amplitude; } 98 | public function set amplitude(value:Number):void { this._amplitude = value; } 99 | 100 | /** Ticker */ 101 | public function get ticker():Number { return this._ticker; } 102 | public function set ticker(value:Number):void { this._ticker = value; } 103 | 104 | /** Frequency */ 105 | public function get frequency():Number { return this._frequency; } 106 | public function set frequency(value:Number):void { this._frequency = value; } 107 | 108 | /** Is Horizontal */ 109 | public function get isHorizontal():Boolean { return this._isHorizontal; } 110 | public function set isHorizontal(value:Boolean):void { this._isHorizontal = value; } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/starling/filters/assets/cross-processing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/src/starling/filters/assets/cross-processing.jpg -------------------------------------------------------------------------------- /src/starling/filters/assets/filmnoise.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cosmindolha/ParticleDesigner/8955ac6aee9661bfe5c4e2c4290f586166c1db84/src/starling/filters/assets/filmnoise.jpg -------------------------------------------------------------------------------- /todolist.txt: -------------------------------------------------------------------------------- 1 | to do 2 | ios test 3 | Load graphics/files from dropbox/google drive 4 | export code>xml 5 | animate params 6 | linear, circular animation 7 | Layers, particle effects, 2D/3D elements 8 | 9 | 10 | Layers can be particles, or graphic (only one) 11 | graphics can be animated, rotation, scale, simple moves 12 | 13 | designs can be saved in local and server db 14 | designs can be exported to be used in Starling 15 | 16 | need layer system 17 | need parser 18 | need connection to db 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | --------------------------------------------------------------------------------