1.1.1 • Published 2 years ago

gunmachan-land v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ぐんまちゃんランド

ぐんまちゃんの遊園地を創造できます。

Get start

npm install gunmachan-land

Attractions

DEMO

ferrisWheel : 観覧車

Description

画面の際をひたすらぐるぐる回ります。

Settings

optionsTypeDefaultDescription
durationnumberゴンドラが 1 周する時間秒数で指定してください。
displaySizestringゴンドラのサイズpx or % で指定してください。(root 要素の横幅が100%)
marginRationumberゴンドラの間隔 ゴンドラの大きさを1とした相対値で指定してください。
rootHTMLElement?document.bodyアトラクションの対象となる要素を指定します。
imgArraystring[]?ぐんまちゃん画像アトラクションに乗車する画像パスを配列で指定します。

Methods

methodTypeDescription
pause() => void一時停止します
restart() => void再生します
destroy(delay?: number) => voidゴンドラを破棄します。delayで秒数を指定すると、その秒数間隔で順番にゴンドラが破棄されます。
resize(displaySize?: string) => voidゴンドラの大きさをリサイズします。引数ががない場合、ferrisWheelを呼び出した際の指定にしたがってリサイズします。

Example

import { ferrisWheel } from 'gunmachan-land';

const ferrisWheelObj = ferrisWheel({
  duration: 10,
  displaySize: '10%',
  marginRatio: 0.5,
});

// 一時停止
ferrisWheelObj.pause();

// 再生
ferrisWheelObj.restart();

// 破棄
ferrisWheelObj.destroy();

// リサイズ
ferrisWheelObj.resize();

Others

PropertyTypeDescription
imagesClassNamestringゴンドラ要素のクラス名
animationDelaynumber前のゴンドラとのアニメーション間隔(秒数)

Example

import { ferrisWheel } from 'gunmachan-land';

const ferrisWheelObj = ferrisWheel({
  duration: 10,
  displaySize: '10%',
  marginRatio: 0.5,
});
const { imagesClassName, animationDelay } = ferrisWheelObj;

// ゴンドラの形を変更する
const images = Array.from(document.querySelectorAll(`.${imagesClassName}`)
images.forEach((img) => {
  img.style.borderRadius = 'none';
})

// 10秒後に先頭から順番にゴンドラを破棄
setTimeout(() => {
  ferrisWheelObj.destroy(animationDelay);
}, 10)

merryGoRound : メリーゴーランド

Description

画面下部をずーっと行ったり来たりします。

Settings

optionsTypeDefaultDescription
durationnumberゴンドラが 1 往復する時間秒数で指定してください。
displaySizestringゴンドラのサイズpx or % で指定してください。(root 要素の横幅が100%)
marginRationumberゴンドラの間隔 ゴンドラの大きさを1とした相対値で指定してください。
rootHTMLElement?document.bodyアトラクションの対象となる要素を指定します。
imgArraystring[]?ぐんまちゃん画像アトラクションに乗車する画像パスを配列で指定します。

Methods

methodTypeDescription
pause() => void一時停止します
restart() => void再生します
destroy(delay?: number) => voidゴンドラを破棄します。delayで秒数を指定すると、その秒数間隔で順番にゴンドラが破棄されます。
resize(displaySize?: string) => voidゴンドラの大きさをリサイズします。引数ががない場合、merryGoRoundを呼び出した際の指定にしたがってリサイズします。

Example

import { merryGoRound } from 'gunmachan-land';

const merryGoRoundObj = merryGoRound({
  duration: 10,
  displaySize: '5%',
  marginRatio: 0.5,
});

// 一時停止
merryGoRoundObj.pause();

// 再生
merryGoRoundObj.restart();

// 破棄
merryGoRoundObj.destroy();

// リサイズ
merryGoRoundObj.resize();

Others

PropertyTypeDescription
imagesClassNamestringゴンドラ要素のクラス名
animationDelaynumber前のゴンドラとのアニメーション間隔(秒数)

Example

import { merryGoRound } from 'gunmachan-land';

const merryGoRoundObj = merryGoRound({
  duration: 10,
  displaySize: '5%',
  marginRatio: 0.5,
});
const { imagesClassName, animationDelay } = merryGoRoundObj;

// ゴンドラの形を変更する
const images = Array.from(document.querySelectorAll(`.${imagesClassName}`)
images.forEach((img) => {
  img.style.borderRadius = 'none';
})

// 10秒後に先頭から順番にゴンドラを破棄
setTimeout(() => {
  merryGoRoundObj.destroy(animationDelay);
}, 10)

coffeeCup : コーヒーカップ

Description

画面内にいるぐんまちゃんをボバーすると回転が速くなる

Settings

optionsTypeDefaultDescription
displayCountnumber表示するコーヒーカップの数を指定してください。
displaySizestringコーヒーカップのサイズpx or % で指定してください。(root 要素の横幅が100%)
defaultSpeednumberコーヒーカップが 1 回転する時間。秒数で指定してください
fastRationumberボバー時のスピード。defaultSpeed1としたときの相対値を指定してください。
rootHTMLElement?document.bodyアトラクションの対象となる要素を指定します。
imgArraystring[]?ぐんまちゃん画像アトラクションに乗車する画像パスを配列で指定します。

Methods

methodTypeDescription
add() => voidコーヒーカップを追加します。
destroy() => voidコーヒーカップを破棄します。

Example

import { coffeeCup } from 'gunmachan-land';

const coffeeCupObj = coffeeCup({
  displayCount: 5,
  displaySize: '50px',
  defaultSpeed: 1,
  fastRatio: 2,
});

// 追加
coffeeCupObj.add();

// 破棄
coffeeCupObj.destroy();

Others

PropertyTypeDescription
imagesClassNamestringゴンドラ要素のクラス名

Example

import { coffeeCup } from 'gunmachan-land';

const coffeeCupObj = coffeeCup({
  displayCount: 5,
  displaySize: '50px',
  defaultSpeed: 1,
  fastRatio: 2,
});
const { imagesClassName, animationDelay } = coffeeCupObj;

// コーヒーカップの形を変更する
const images = Array.from(document.querySelectorAll(`.${imagesClassName}`)
images.forEach((img) => {
  img.style.borderRadius = 'none';
})

skyDiving : スカイダイビング

Description

上からぐんまちゃんが降ってきます

Settings

optionsTypeDefaultDescription
displaySizestringぐんまちゃんのサイズpx or % で指定してください。(root 要素の横幅が100%)
speednumberぐんまちゃんが下まで落ちる時間秒数で指定してください。
rootHTMLElement?document.bodyアトラクションの対象となる要素を指定します。
imgArraystring[]?ぐんまちゃん画像アトラクションに乗車する画像パスを配列で指定します。

Methods

methodTypeDescription
add() => void空からぐんまちゃんを降らす

Example

import { skyDiving } from 'gunmachan-land';

const skyDivingObj = skyDiving({
  displaySize: '5%',
  speed: 0.5,
});

// ぐんまちゃんを降らす
skyDivingObj.add();

Others

PropertyTypeDescription
imagesClassNamestringぐんまちゃん要素のクラス名

Example

import { skyDiving } from 'gunmachan-land';

const skyDivingObj = skyDiving(10, '10%', 0.5);
const { imagesClassName } = skyDivingObj;

// ぐんまちゃんの形を変更する
const images = Array.from(document.querySelectorAll(`.${imagesClassName}`)
images.forEach((img) => {
  img.style.clipPath = 'xxx';
})

Accompany : おともぐんまちゃん

Description

ぐんまちゃんがマウスに追従します。

Settings

const gchan = new GchanLand(root);
gchan.accompany(duration, displaySize, marginRatio);
paramTypeDescription
displayCountnumberおともにするぐんまちゃんの数
displaySizestringぐんまちゃんのサイズpx or % で指定してください。(root 要素の横幅が100%)
intervalnumberぐんまちゃん同士の間隔 ぐんまちゃんの大きさを1とした相対値で指定してください。

Methods

methodTypeDescription
resize(displaySize?: string) => voidぐんまちゃんの大きさをリサイズします。引数ががない場合、accompanyを呼び出した際の指定にしたがってリサイズします。
destroy(delay?: number) => voidお連れ様を解散させます。delayで秒数を指定すると、その秒数間隔で順番にゴンドラが破棄されます。

Example

const accompanyObj = gchan.accompany(10, '10%', 0.5);

// リサイズ
accompanyObj.resize();

// お連れ様解散
accompanyObj.destroy();

Others

PropertyTypeDescription
imagesClassNamestringぐんまちゃん要素のクラス名

Example

const accompanyObj = gchan.accompany(10, '10%', 0.5);
const { imagesClassName, animationDelay } = accompanyObj;

// ぐんまちゃんの形を変更する
const images = Array.from(document.querySelectorAll(`.${imagesClassName}`)
images.forEach((img) => {
  img.style.borderRadius = 'none';
})

工事中

  • ジェットコースター
    • ぐんまちゃんが縦横無尽に画面内をうろうろする
  • お化け屋敷
    • 突然画面内にぐんまちゃんが現れる。そのうち消える