ctx.translate(x, y)
и поворачивать на угол ctx.rotate(a)
.if(gte(t,9)*lte(t,29)
if(gte(t,20)*lte(t,25)
ffmpeg \
-y \
-i "$file" \
-vcodec libx264 \
-movflags +faststart \
-threads 0 \
-r 25 \
-g 50 \
-crf 25 \
-me_method hex \
-trellis 0 \
-bf 8 \
-acodec aac \
-strict \
-2 \
-ar 44100 \
-ab 128k \
-f mp4 \
-vf "movie=watermark.png [wm];[in][wm] overlay='if(gte(t,9)*lte(t,29), W-((W+w)/20)*mod(t-9,20), -w-1000)':'0' [out]" \
"out/$file"
const img = document.querySelector("img");
const canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
const ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
canvas.toBlob((blob) => {
blob.arrayBuffer()
.then((buf) => {
// тут как-то отправить эту буффонаду через WebSocket
})
.catch(console.error)
;
}, "image/png");
var array = [
{
'key1': 'value1'
},
{
'key2': 'value2'
},
{'key1': 'value1-b'},
{'key1': 'value1-c'},
]
Массив объектов, в каждом из которых всего по 1 свойству. str
, и на выходе, видимо, массив значений. const getValues = (array, key) => array.filter((item) => item.hasOwnProperty(key))
.map((item) => item[key]);
getValues(array, "key1") // [ "value1", "value1-b", "value1-c" ]
const startDate = new Date(2021, 7, 8); // начало отсчёта
const today = new Date(); // сегодня
const daysPassed = Math.floor((today - startDate) / 864e5);
const future = new Date();
future.setDate(future.getDate() + 3 - daysPassed % 3);
document.querySelector('span.myDate')
.textContent = new Intl.DateTimeFormat(
'ru-RU',
{ month: 'long', day: 'numeric' }
)
.format(future);
:value="xxx"
selected
— точно так же0
потому, что первая буква имеет индекс 0
.s.length
– т.к. у последней буквы строки индекс s.length - 1
i++
или i = i + 1
— по одной позиции направо продвигаемся. ctx.clearRect(0 , 0 , ctx.canvas.width , ctx.canvas.height)
https://site.ru/download/1202
и веб сервер отдаст на этот запрос файл с того секретного сайта с id 1202
.