Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* HOW TO GET THIS SHIT UP AND RUNNING
- a smol guide by midgetsausage. no I didn't write this code
- 1. Make a 1920x1080 rectangle. If you want a 4:3 V-Cam, type in 1440 instead of 1920.
- 2. Make it a Movie Clip symbol with the registration/anchor point in the center.
- 3. Go in the newly made symbol by double-clicking it, and make a new layer in it.
- 4. Click the frame of the new layer, and hit F9 to bring up the Actions panel.
- 5. Copy paste below code into Actions panel.
- 6. Voila. Exit the symbol and use it as you wish.
- Alan Becker made a similar guide here, years prior. He also goes into detail on how to actually use the thing.
- https://www.youtube.com/watch?v=Np2LXXk-uHw
- */
- var cameraTrans:Transform = new Transform(this);
- var stageTrans:Transform = new Transform(parent);
- visible = false;
- stage.addEventListener(Event.ENTER_FRAME, updateStage);
- function updateStage(...rest) {
- parent.filters = filters;
- stageTrans.colorTransform = cameraTrans.colorTransform;
- var stageMatrix:Matrix = cameraTrans.matrix;
- stageMatrix.invert();
- stageMatrix.translate(stage.stageWidth*.5, stage.stageHeight*.5);
- stageTrans.matrix = stageMatrix;
- };
- updateStage();
- addEventListener(Event.REMOVED_FROM_STAGE, resetStage);
- function resetStage(...rest) {
- stage.removeEventListener(Event.ENTER_FRAME, updateStage);
- stageTrans.matrix = new Matrix();
- stageTrans.colorTransform = new ColorTransform();
- parent.filters = new Array();
- }
Add Comment
Please, Sign In to add comment