Git Product home page Git Product logo

kousensai-web's Issues

Cardのチャイルド(pin-cotainer)にapplyRandomStylesの値をパスする方法

元々のapplyRandomStyles()はCardのチャイルドのstyleは変更できない。
この方法でいいか確認してほしいです。

変更項目:
・applyRandomStyles()

applyRandomStyles() {
this.cardStyles = this.projects.map( () => {
const rotate = Math.floor(Math.random() * 10) - 5; // -10度から10度までのランダムな傾き
const scale = Math.random() * 0.1 + 0.95; // 0.95から1.05までのランダムな大きさ
const x = Math.floor(Math.random() * 21) - 10; // -10pxから10pxまでのランダムな横位置
const y = Math.floor(Math.random() * 21) - 10; // -10pxから10pxまでのランダムな縦位置
const backgroundX = Math.floor(Math.random() * 100);
const backgroundY = Math.floor(Math.random() * 100);
const childX = ((Math.random() * 2) + 4) * 10; // 40%から60%までのランダムなマージン
const colorRotate = Math.floor(Math.random() * 360);
return {
'parentStyle': {
'transform': `rotate(${rotate}deg) scale(${scale})`,
'margin': `${y}px ${10 + x}px 0`,
'background-position': `${backgroundX}% ${backgroundY}%`,
// 'filter': `hue-rotate(${colorRotate}deg)`
},
'childStyle': {
'margin': `1rem auto 1rem ${childX}%`
}
};

・Introduction.vueのHTML

<Card class="card" :style="cardStyles[index]['parentStyle']" :child_style="cardStyles[index]['childStyle']" v-for="(i, index) in projects" :key="index" :id="i.id"
:vote="i.vote" :team_name="i.team_name" :project_name="i.project_name" :project_space="i.project_space"
:project_description="i.project_description" :imagePath="'src/assets/nelnel.jpg'" />

・Card.vue:

<div class="pin-container" :style="child_style">
<img src="" alt="pin">
</div>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.