// Created using compCode v1.0.4 // NaN04 from composition "Hover-Cursors" in project "untitled project" // // aescripts.com/compCode compCode_NaN04_084943(); function compCode_NaN04_084943() { app.beginUndoGroup("Hover-Cursors"); try { var tempStartingComp = app.project.activeItem; if (!tempStartingComp || !(tempStartingComp instanceof CompItem)) { alert("Please select a composition first"); return; } // Create Folder hierarchy var cursors_folder = getItem("Cursors", FolderItem, app.project.rootFolder); if (cursors_folder === null) { cursors_folder = app.project.items.addFolder("Cursors"); cursors_folder.label = 2; } // Create Compositions var hovercursors_comp = tempStartingComp; // Import all FootageItems var icons8naturaluserinterface2png_footage = getItem("icons8-natural-user-interface-2.png", FileSource, cursors_folder); if (icons8naturaluserinterface2png_footage === null) { var icons8naturaluserinterface2png_path = "/t/Pictures/VisualAssets/cursors/icons8-natural-user-interface-2.png"; var icons8naturaluserinterface2png_importOptions = new ImportOptions(new File(icons8naturaluserinterface2png_path)); var icons8naturaluserinterface2png_footage = app.project.importFile(icons8naturaluserinterface2png_importOptions); icons8naturaluserinterface2png_footage.label = 5; icons8naturaluserinterface2png_footage.parentFolder = cursors_folder; icons8naturaluserinterface2png_footage.selected = false; } var icons8cursorpng_footage = getItem("icons8-cursor.png", FileSource, cursors_folder); if (icons8cursorpng_footage === null) { var icons8cursorpng_path = "/t/Pictures/VisualAssets/cursors/icons8-cursor.png"; var icons8cursorpng_importOptions = new ImportOptions(new File(icons8cursorpng_path)); var icons8cursorpng_footage = app.project.importFile(icons8cursorpng_importOptions); icons8cursorpng_footage.label = 5; icons8cursorpng_footage.parentFolder = cursors_folder; icons8cursorpng_footage.selected = false; } // Working with comp "Hover-Cursors", varName "hovercursors_comp"; hovercursors_comp.openInViewer(); var visual = hovercursors_comp.layers.addText("0"); visual.name = "visual"; visual.enabled = false; visual.shy = true; visual.moveToEnd(); var visual_TextProp = visual.property("ADBE Text Properties").property("ADBE Text Document"); var visual_TextDocument = visual_TextProp.value; visual_TextDocument.font = "PressStyle"; visual_TextDocument.fontSize = 80; visual_TextDocument.applyFill = true; visual_TextDocument.fillColor = [0.92548996210098,0.92548996210098,0.92548996210098]; visual_TextDocument.applyStroke = false; visual_TextDocument.justification = ParagraphJustification.LEFT_JUSTIFY; visual_TextDocument.tracking = 0; if (parseFloat(app.version) >= 13.2 ) { visual_TextDocument.verticalScale = 1; visual_TextDocument.horizontalScale = 0.9099999666214; visual_TextDocument.baselineShift = 0; visual_TextDocument.tsume = 0; // These values are read-only. You have to set them manually in the comp. // visual_TextDocument.fauxBold = false; // visual_TextDocument.fauxItalic = false; // visual_TextDocument.allCaps = false; // visual_TextDocument.smallCaps = false; // visual_TextDocument.superscript = false; // visual_TextDocument.subscript = false; } visual_TextProp.setValue(visual_TextDocument); visual.property("ADBE Transform Group").property("ADBE Position").setValue([41,155,0]); // Add Shape Layer "CTRL", varName "ctrl"; var ctrl = hovercursors_comp.layers.addShape(); ctrl.name = "CTRL"; ctrl.moveToEnd(); var ctrlPosition = ctrl.property("ADBE Transform Group").property("ADBE Position"); var ctrlPosition_keyTimesArray = [0,0.83416750083417,1.2012012012012,1.63496830163497,2.06873540206874,2.46913580246914,3.43677010343677,4.77143810477144,6.00600600600601,6.74007340674007,7.24057390724057,8.37504170837504]; var ctrlPosition_valuesArray = [[71.0000000000018,607,0],[580.000000000002,402,0],[580.000000000002,402,0],[1022,402,0],[824.253586854704,426.539179125756,0],[805.623653191428,425.281619359796,0],[1022,614,0],[1083.98106094814,210.389126184766,0],[790.362422476379,134.636963412743,0],[608.840356957345,291.960817530402,0],[608.840356957345,291.960817530402,0],[207.000000000002,96,0]]; ctrlPosition.setValuesAtTimes(ctrlPosition_keyTimesArray, ctrlPosition_valuesArray); var ctrlPosition_inSpatialTangents = [[-84.8333358764648,34.1666679382324,0],[-158.5,34.1666679382324,0],[0,0,0],[-73.6666641235352,-35.3333320617676,0],[-13.9118824005127,-24.7562637329102,0],[-28.9671306610107,-24.4357376098633,0],[76.6899719238281,28.7940254211426,0],[99.4106292724609,62.8316268920898,0],[116.595169067383,10.6445589065552,0],[60.3041000366211,1.56332969665527,0],[0,0,0],[47.0465850830078,29.9020023345947,0]]; var ctrlPosition_outSpatialTangents = [[84.8333358764648,-34.1666679382324,0],[0,0,0],[0,0,0],[18.0147113800049,8.64054012298584,0],[10.8583040237427,19.3224048614502,0],[85.6850967407227,72.2811889648438,0],[-43.1976280212402,-16.2189865112305,0],[-69.4922256469727,-43.9219589233398,0],[-59.4314880371094,-5.42579889297485,0],[0,0,0],[0,0,0],[-135.83332824707,-86.3333358764648,0]]; applySpatialTangents(ctrlPosition, ctrlPosition_keyTimesArray, ctrlPosition_inSpatialTangents, ctrlPosition_outSpatialTangents); var ctrlPosition_easeInSpeedArray = [0,658.836971338893,0,1023.90760712303,477.56611664305,118.40645835946,330.808110946131,322.224962237206,247.683227742797,337.820085555385,0,394.151101153969]; var ctrlPosition_easeInInfluArray = [16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667]; var ctrlPosition_easeOutSpeedArray = [658.836971338893,0,1023.90760712303,477.56611664305,118.40645835946,330.808110946131,322.224962237206,247.683227742797,337.820085555385,0,394.151101153969,0]; var ctrlPosition_easeOutInfluArray = [16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667,16.666666667]; var ctrlPosition_keyInInterpolationType = [KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR]; var ctrlPosition_keyOutInterpolationType = [KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.HOLD,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.HOLD,KeyframeInterpolationType.LINEAR,KeyframeInterpolationType.LINEAR]; applyEasing(ctrlPosition, ctrlPosition_keyTimesArray, [ctrlPosition_easeInSpeedArray, ctrlPosition_easeInInfluArray], [ctrlPosition_easeOutSpeedArray, ctrlPosition_easeOutInfluArray], [ctrlPosition_keyInInterpolationType, ctrlPosition_keyOutInterpolationType]); ctrl.property("ADBE Transform Group").property("ADBE Scale").setValue([100,100,100]); // Add existing footage item "icons8-natural-user-interface-2.png", varName "icons8naturaluserinterface2png_footage"; var icons8naturaluserinterface2png = hovercursors_comp.layers.add(icons8naturaluserinterface2png_footage); icons8naturaluserinterface2png.shy = true; icons8naturaluserinterface2png.moveToEnd(); icons8naturaluserinterface2png.property("ADBE Transform Group").property("ADBE Anchor Point").setValue([18,-13.84,0]); icons8naturaluserinterface2png.property("ADBE Transform Group").property("ADBE Position").setValue([-6.54000000000002,-41.4199999999999,0]); icons8naturaluserinterface2png.property("ADBE Transform Group").property("ADBE Scale").setValue([218,218,100]); icons8naturaluserinterface2png.property("ADBE Transform Group").property("ADBE Opacity").setValue(100); // Add existing footage item "icons8-cursor.png", varName "icons8cursorpng_footage"; var icons8cursorpng = hovercursors_comp.layers.add(icons8cursorpng_footage); icons8cursorpng.shy = true; icons8cursorpng.moveToEnd(); icons8cursorpng.property("ADBE Transform Group").property("ADBE Anchor Point").setValue([-79,4,0]); icons8cursorpng.property("ADBE Transform Group").property("ADBE Position").setValue([-229.000000000002,0,0]); icons8cursorpng.property("ADBE Transform Group").property("ADBE Scale").setValue([245,245,100]); icons8cursorpng.property("ADBE Transform Group").property("ADBE Opacity").setValue(100); var textColourSwitch = hovercursors_comp.layers.addText("click"); textColourSwitch.name = "text Colour Switch"; textColourSwitch.shy = true; textColourSwitch.moveToEnd(); var textColourSwitch_TextProp = textColourSwitch.property("ADBE Text Properties").property("ADBE Text Document"); var textColourSwitch_TextDocument = textColourSwitch_TextProp.value; textColourSwitch_TextDocument.font = "Roboto-Thin"; textColourSwitch_TextDocument.fontSize = 89; textColourSwitch_TextDocument.applyFill = true; textColourSwitch_TextDocument.fillColor = [0,0,0]; textColourSwitch_TextDocument.applyStroke = false; textColourSwitch_TextDocument.justification = ParagraphJustification.LEFT_JUSTIFY; textColourSwitch_TextDocument.tracking = 0; if (parseFloat(app.version) >= 13.2 ) { textColourSwitch_TextDocument.verticalScale = 1; textColourSwitch_TextDocument.horizontalScale = 0.9099999666214; textColourSwitch_TextDocument.baselineShift = 0; textColourSwitch_TextDocument.tsume = 0; // These values are read-only. You have to set them manually in the comp. // textColourSwitch_TextDocument.fauxBold = false; // textColourSwitch_TextDocument.fauxItalic = false; // textColourSwitch_TextDocument.allCaps = false; // textColourSwitch_TextDocument.smallCaps = false; // textColourSwitch_TextDocument.superscript = false; // textColourSwitch_TextDocument.subscript = false; } textColourSwitch_TextProp.setValue(textColourSwitch_TextDocument); textColourSwitch.property("ADBE Transform Group").property("ADBE Anchor Point").setValue([78.5381469726563,-32.9404296875,0]); textColourSwitch.property("ADBE Transform Group").property("ADBE Position").setValue([640.000000119209,360,0]); textColourSwitch.property("ADBE Transform Group").property("ADBE Opacity").setValue(100); var click = hovercursors_comp.layers.addText("click"); click.name = "click"; click.moveToEnd(); var click_TextProp = click.property("ADBE Text Properties").property("ADBE Text Document"); var click_TextDocument = click_TextProp.value; click_TextDocument.font = "Roboto-Thin"; click_TextDocument.fontSize = 89; click_TextDocument.applyFill = true; click_TextDocument.fillColor = [0.92548996210098,0.92548996210098,0.92548996210098]; click_TextDocument.applyStroke = false; click_TextDocument.justification = ParagraphJustification.LEFT_JUSTIFY; click_TextDocument.tracking = 0; if (parseFloat(app.version) >= 13.2 ) { click_TextDocument.verticalScale = 1; click_TextDocument.horizontalScale = 0.9099999666214; click_TextDocument.baselineShift = 0; click_TextDocument.tsume = 0; // These values are read-only. You have to set them manually in the comp. // click_TextDocument.fauxBold = false; // click_TextDocument.fauxItalic = false; // click_TextDocument.allCaps = false; // click_TextDocument.smallCaps = false; // click_TextDocument.superscript = false; // click_TextDocument.subscript = false; } click_TextProp.setValue(click_TextDocument); click.property("ADBE Transform Group").property("ADBE Anchor Point").setValue([78.5381469726563,-32.9404296875,0]); click.property("ADBE Transform Group").property("ADBE Position").setValue([640.000000119209,360,0]); // Add Shape Layer "BG", varName "bg"; var bg = hovercursors_comp.layers.addShape(); bg.name = "BG"; bg.label = 14; bg.shy = true; bg.moveToEnd(); bg.property("ADBE Root Vectors Group").addProperty("ADBE Vector Group"); bg.property("ADBE Root Vectors Group").property(1).name = "Rectangle 1"; bg.property("ADBE Root Vectors Group").property(1).property(2).addProperty("ADBE Vector Shape - Rect"); bg.property("ADBE Root Vectors Group").property(1).property(2).property(1).property("ADBE Vector Rect Size").setValue([456,100]); bg.property("ADBE Root Vectors Group").property(1).property(2).property(1).property("ADBE Vector Rect Roundness").setValue(8); bg.property("ADBE Root Vectors Group").property(1).property(2).addProperty("ADBE Vector Graphic - G-Stroke"); bg.property("ADBE Root Vectors Group").property(1).property(2).property(2).enabled = false; bg.property("ADBE Root Vectors Group").property(1).property(2).property(2).property("ADBE Vector Stroke Width").setValue(16); bg.property("ADBE Root Vectors Group").property(1).property(2).addProperty("ADBE Vector Graphic - Fill"); bg.property("ADBE Root Vectors Group").property(1).property(2).property(3).property("ADBE Vector Fill Color").setValue([0.65882352941176,0.65882352941176,0.65882352941176,1]); bg.property("ADBE Root Vectors Group").property(1).property(2).property(3).property("ADBE Vector Fill Opacity").setValue(99); bg.property("ADBE Root Vectors Group").property(1).property(3).property("ADBE Vector Position").setValue([76,-16]); bg.property("ADBE Transform Group").property("ADBE Anchor Point").setValue([76,-16,0]); bg.property("ADBE Transform Group").property("ADBE Scale").setValue([100,135.294117647059,100]); // Add Shape Layer "Button Shape", varName "buttonShape"; var buttonShape = hovercursors_comp.layers.addShape(); buttonShape.name = "Button Shape"; buttonShape.label = 14; buttonShape.moveToEnd(); buttonShape.property("ADBE Root Vectors Group").addProperty("ADBE Vector Group"); buttonShape.property("ADBE Root Vectors Group").property(1).name = "Rectangle 1"; buttonShape.property("ADBE Root Vectors Group").property(1).property(2).addProperty("ADBE Vector Shape - Rect"); buttonShape.property("ADBE Root Vectors Group").property(1).property(2).property(1).property("ADBE Vector Rect Size").setValue([456,100]); buttonShape.property("ADBE Root Vectors Group").property(1).property(2).property(1).property("ADBE Vector Rect Roundness").setValue(8); buttonShape.property("ADBE Root Vectors Group").property(1).property(2).addProperty("ADBE Vector Graphic - G-Stroke"); buttonShape.property("ADBE Root Vectors Group").property(1).property(2).property(2).enabled = false; buttonShape.property("ADBE Root Vectors Group").property(1).property(2).property(2).property("ADBE Vector Stroke Width").setValue(16); buttonShape.property("ADBE Root Vectors Group").property(1).property(2).addProperty("ADBE Vector Graphic - Fill"); buttonShape.property("ADBE Root Vectors Group").property(1).property(2).property(3).property("ADBE Vector Fill Color").setValue([1,0.28627447988473,0.28627447988473,1]); buttonShape.property("ADBE Root Vectors Group").property(1).property(2).property(3).property("ADBE Vector Fill Opacity").setValue(99); buttonShape.property("ADBE Root Vectors Group").property(1).property(3).property("ADBE Vector Position").setValue([76,-16]); buttonShape.property("ADBE Transform Group").property("ADBE Anchor Point").setValue([76,-16,0]); buttonShape.property("ADBE Transform Group").property("ADBE Scale").setValue([100,135.294117647059,100]); // Apply parents icons8naturaluserinterface2png.setParentWithJump(ctrl); icons8cursorpng.setParentWithJump(ctrl); // Lock Layers icons8naturaluserinterface2png.locked = true; icons8cursorpng.locked = true; bg.locked = true; buttonShape.locked = true; // Apply expressions to properties try { visual.property("ADBE Text Properties").property("ADBE Text Document").expression = "point = thisComp.layer(\"CTRL\").transform.position;" + "\n" + "" + "\n" + "shape = thisComp.layer(\"Button Shape\");" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "a = shape.sampleImage(point, [.5, .5])[0];" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "linear(a, 0, 1, 0, 100)"; icons8naturaluserinterface2png.property("ADBE Transform Group").property("ADBE Opacity").expression = "point = thisComp.layer(\"CTRL\").transform.position;" + "\n" + "" + "\n" + "shape = thisComp.layer(\"Button Shape\");" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "a = shape.sampleImage(point, [.5, .5])[0];" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "linear(a, 0, 1, 0, 100)"; icons8cursorpng.property("ADBE Transform Group").property("ADBE Opacity").expression = "point = thisComp.layer(\"CTRL\").transform.position;" + "\n" + "" + "\n" + "shape = thisComp.layer(\"Button Shape\");" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "a = shape.sampleImage(point, [.5, .5])[0];" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "linear(a, 0, 1, 100, 0)"; textColourSwitch.property("ADBE Transform Group").property("ADBE Opacity").expression = "point = thisComp.layer(\"CTRL\").transform.position;" + "\n" + "" + "\n" + "shape = thisComp.layer(\"Button Shape\");" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "a = shape.sampleImage(point, [.5, .5])[0];" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "linear(a, 0, 1, 0, 100)"; bg.property("ADBE Root Vectors Group").property(1).property(2).property(3).property("ADBE Vector Fill Opacity").expression = "point = thisComp.layer(\"CTRL\").transform.position;" + "\n" + "" + "\n" + "shape = thisComp.layer(\"Button Shape\");" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "a = shape.sampleImage(point, [.5, .5])[0];" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "linear(a, 0, 1, 0, 100)"; } catch (err) {} hovercursors_comp.openInViewer(); } catch(e) { alert(e.toString() + "\nError on line: " + e.line.toString()); } app.endUndoGroup(); function getItem(itemName, itemInstanceName, locationObject) { if (locationObject.numItems > 0) { for (var i = 1; i <= locationObject.numItems; i ++) { var curItem = locationObject.item(i); if (curItem.name === itemName) { if (curItem instanceof itemInstanceName || (curItem.mainSource !== "undefined" && curItem.mainSource instanceof itemInstanceName)) { return curItem; } } } } return null; } function applyEasing(property, keyTimesArray, easeInArray, easeOutArray, keyInterpolationArray) { for (var i = 0; i < keyTimesArray.length; i ++) { if (property.propertyValueType === PropertyValueType.TwoD) { var easeIn0 = new KeyframeEase(easeInArray[0][i][0], easeInArray[1][i][0]); var easeOut0 = new KeyframeEase(easeOutArray[0][i][0], easeOutArray[1][i][0]); var easeIn1 = new KeyframeEase(easeInArray[0][i][1], easeInArray[1][i][1]); var easeOut1 = new KeyframeEase(easeOutArray[0][i][1], easeOutArray[1][i][1]); property.setTemporalEaseAtKey(i+1, [easeIn0, easeIn1], [easeOut0, easeOut1]); } else if (property.propertyValueType === PropertyValueType.ThreeD) { var easeIn0 = new KeyframeEase(easeInArray[0][i][0], easeInArray[1][i][0]); var easeOut0 = new KeyframeEase(easeOutArray[0][i][0], easeOutArray[1][i][0]); var easeIn1 = new KeyframeEase(easeInArray[0][i][1], easeInArray[1][i][1]); var easeOut1 = new KeyframeEase(easeOutArray[0][i][1], easeOutArray[1][i][1]); var easeIn2 = new KeyframeEase(easeInArray[0][i][2], easeInArray[1][i][2]); var easeOut2 = new KeyframeEase(easeOutArray[0][i][2], easeOutArray[1][i][2]); property.setTemporalEaseAtKey(i+1, [easeIn0, easeIn1, easeIn2], [easeOut0, easeOut1, easeOut2]); } else { var easeIn = new KeyframeEase(easeInArray[0][i], easeInArray[1][i]); var easeOut = new KeyframeEase(easeOutArray[0][i], easeOutArray[1][i]); if (keyInterpolationArray[1][i] !== KeyframeInterpolationType.HOLD) { property.setTemporalEaseAtKey(i+1, [easeIn], [easeOut]); } else { property.setTemporalEaseAtKey(i+1, [easeIn]); } } property.setInterpolationTypeAtKey(i+1, keyInterpolationArray[0][i], keyInterpolationArray[1][i]); } } function applySpatialTangents(property, keyTimesArray, inSpatialTangentsArray, outSpatialTangentsArray) { for (var sp = 0; sp < keyTimesArray.length; sp ++) { property.setSpatialTangentsAtKey(sp+1, inSpatialTangentsArray[sp], outSpatialTangentsArray[sp]); } } }