Categories
code Tips and Guides

Part- 3 Illustrator Scripting Looping the shape within layer

Below is couple of functions that takes parameter of active layer and process individual element to change color. function iterateOverGroup(groupCoreItem,colorIs){ for (var ai = 0; ai < groupCoreItem.pathItems.length; ai++) { colorShape(groupCoreItem.pathItems[ai],colorIs); } for (var gi = 0; gi <groupCoreItem.groupItems.length; gi++) { iterateOverGroup(groupCoreItem.groupItems[gi],colorIs); } for (var ci = 0; ci <groupCoreItem.compoundPathItems.length; ci++) { var compoundPath = […]

Categories
code

Area Calculation Javascript

function areaOfCircle(radius) { return Math.PI * Math.pow(radius, 2); } function areaOfRectangle(width, height) { return width * height; } function areaOfSphere(radius) { return 4 * Math.PI * (Math.pow(radius, 2)); } function areaOfTriangle(baseWidth, height) { return baseWidth * height / 2; }

Categories
code

Retina Display Media queries

@media only screen and (min-width: 320px) { } /* Retina enabled devices with smaller screen */ @media only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px), only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px), only screen and ( min-device-pixel-ratio: 2) and (min-width: 320px), only screen and ( min-resolution: 192dpi) and (min-width: 320px), only screen and […]

Categories
code

Use Picture tag to create responsive image (html)

<picture> <!– Default low resolution image –> <source srcset=”small.jpg” type=”image/jpg”> <!– Medium resolution image –> <source srcset=”medium.jpg” media=”(min-width: 768px)”> <!–High resolution Image –> <source srcset=”large.jpg” media=”(min-width: 1200px)”> <!– Fallback image incase the picture element is not supported –> <img src=”small.jpg” alt=”description of image”> </picture>