Is it possible in Google Apps Script to programmatically fill a shape in Google Slides with a gradient? - google-apps-script

I would like to be able to, on each individual slide, set a rectangle shape that has a randomly generated gradient, but I can't find any functions to set shape fill to a gradient? Am I just overlooking it, or has it not been implemented?

Issue:
Unfortunately, in the current stage, it seems that there are no methods for setting the gradient color using Google Slides service and Google Slides API. This has already been reported to Google issue tracker as follows.
https://issuetracker.google.com/issues/179455333
https://issuetracker.google.com/issues/191392267
Workaround:
From I would like to be able to, on each individual slide, set a rectangle shape that has a randomly generated gradient, in this case, as the current workaround, how about the following flow?
Manually create multiple shapes by changing the gradient color.
When you want to put a shape on a slide, one of the shapes you have already created is randomly selected and copied, and put on the slide.
In this case, you can change the size of the shape after the shape was put.

Related

Swap a draw with an image in Google Doc

I have various Word documents (.docx) saved in Google Drive, everyone has inside a draw composed of text, borders, and a pen-draw, grouped together.
When opened in Google Doc the .docx files to edit, the group appear as a draw composed of the same elements except the pen-draw that is missing.
So I need to solve this, 2 options:
Replace the draw with a saved image
Edit the draw and put inside an image, save&close the draw
Since it is an operation repeated ten times every day I want to find a way to automate this with google appscripts
Any suggestion ?

Google Apps Script - Slides - replaceWithImage too slow

I'm using Apps Script to generate slides containing tiles.
Each tile contain some information, example: name, ID and an image.
To generate each slide & each tile, I'm using a template composed of shapes, each shape to be modified contains a label such as {{label}}
When I find {{image}} shape, I replace the shape by an image.
Images are stored on Drive. I put everything in place to retrieve the blob associated to image but the single operation replaceWithImage takes around 2 seconds (I used console.time/timeEnd just before replaceWithImage and after).
Any idea how to accelerate this ? Initially I was suspecting the search on Drive, but it's around 200ms to look for the file and get the blob.

Google Slides - Change Shape Adjustments from script

Some shapes e.g. in Google Slides have kind of markers to adjust the shapes design.
(Example Pie-Shape, Arrow-Shape)
This is working in the UI very well, but how to adjust it, using g-script.
Markers - see yellow boxes
In MS-Office VBA such is called Adjustments and we can get a Array of all this markers to change it.
After several hours searching the Google Apps Api and the internet I stopped frustrated searching because I didn't find anything promising.

How to add a background image to google maps markers?

I'm using foursquare API to show some places on a map. When I tried to render the icons in the categories some images give 404. Ex:
https://foursquare.com/img/categories_v2/shops/mall.png
So I change the pattern to match this path that is the path that foursquare uses for it's icons:
https://foursquare.com/img/categories_v2/shops/mall_32.png
The problem now is that these icons have transparent background (which looks confusing) and I want to know a way to attach these markers some kind of background.
Thanks!
PD: I don't want to use shadows because I read it's deprecated.
Google map markers are put in place as Canvas elements not DOM elements, and there's no direct equivalent of a background image.
You could try one of two things :
Create your own marker image complete with a halo or background rectangle, then specify your image as the icon when marker(s) are created (see the marker options section of the documentation).
Create a general purpose background image with no foreground then, for each required marker create two markers positioned such that the foreground overlays the background.
The first approach is more efficient and would generally be preferred.
The second approach might be useful if you had many types of marker and wanted each of them to be set against the same background image. This would be inefficient in terms of client CPU and RAM but would save you time in preparing the artwork.

Draw a path on a Google Map on one side only?

I'd like to replicate the outline effect shown on this map: https://maps.google.co.uk/maps?hl=en&safe=off&q=switzerland&ie=UTF-8&hq=&hnear=0x478c64ef6f596d61:0x5c56b5110fcb7b15,Switzerland&gl=uk&ei=PXO3UK3UPMS1hAfmjoDgBQ&sqi=2&ved=0CKQBELYD
In other words, I'd like to draw a path that:
is shown along one side only of the path defined in GeoJSON
fades in transparency from the outer side of the path to the inner?
Are either of these things possible with the Google Maps API?
I believe to do this you would need to create a custom overlay - which can be a somewhat daunting task. See the documentation on Custom Overlays for a basic example.
Were I implementing this, I would create an overlay which used HTML5 canvas elements as tiles.