Giter Site home page Giter Site logo

Comments (3)

eeeesong avatar eeeesong commented on September 1, 2024

우선 위치가 맞도록 맞춰놓긴 했는데
이 부분에 시간을 더 투자하는 게 적절하지 않을 것 같아서 우선 넘어가는 것이 나을 것 같습니다!

from baseball.

eeeesong avatar eeeesong commented on September 1, 2024

ezgif-7-fd2c592fa4d5

from baseball.

eeeesong avatar eeeesong commented on September 1, 2024

현재 코드

BaseDrawingProperty

    struct BaseDrawingProperty {
        let id: Int
        let origin: CGPoint
        let size: CGSize
        
        func centerMovedBy(x: CGFloat, y: CGFloat) -> CGPoint {
            let newX = origin.x + x + size.width / 2
            let newY = origin.y + y - size.height / 2
            return CGPoint(x: newX, y: newY)
        }
    }

Player 초기 설정

private func addPlayer(to baseInfo: BaseDrawingProperty) {
        
        let playerWidth = width * 0.06
        let playerHeight = playerWidth * 1.5
        let playerSize = CGSize(width: playerWidth, height: playerHeight)
        
        let offsetX = playerWidth / 2 
        let playerOrigin = baseInfo.centerMovedBy(x: -offsetX, y: 0)
        //(이하 생략)
  • x만 옮겨줌

애니메이션 부분

private func animatePlayer(with fromBaseInfo: BaseDrawingProperty,_ toBaseInfo: BaseDrawingProperty, duration: Double, delay: Double) {

        let offsetY = player.frame.height / 2
        let fromPosition = fromBaseInfo.centerMovedBy(x: 0, y: offsetY)
        let toPosition = toBaseInfo.centerMovedBy(x: 0, y: offsetY)
        //(이하 생략)
  • y만 옮겨줌

from baseball.

Related Issues (20)

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.